File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -287,7 +287,8 @@ def supports_js_redirection?
287287 'angular~1.2' => 'angularjs~1.2'
288288 }
289289
290- get %r{\A /([\w ~\. ]+)(\- [\w \- ]+)?(/.*)?\z } do |doc , type , rest |
290+ get %r{\A /([\w ~\. %]+)(\- [\w \- ]+)?(/.*)?\z } do |doc , type , rest |
291+ doc . sub! '%7E' , '~'
291292 return redirect "/#{ DOC_REDIRECTS [ doc ] } #{ type } #{ rest } " if DOC_REDIRECTS . key? ( doc )
292293 return redirect "/angularjs/api#{ rest } " , 301 if doc == 'angular' && rest . start_with? ( '/ng' )
293294 return 404 unless @doc = find_doc ( doc )
Original file line number Diff line number Diff line change @@ -164,6 +164,14 @@ def app
164164 assert last_response . not_found?
165165 end
166166
167+ it "decodes '~' properly" do
168+ get '/html%7E5/'
169+ assert last_response . ok?
170+
171+ get '/html%7E42/'
172+ assert last_response . not_found?
173+ end
174+
167175 it "redirects with trailing slash" do
168176 get '/html'
169177 assert last_response . redirect?
You can’t perform that action at this time.
0 commit comments