Skip to content

Commit

Permalink
unescape path so that we can more easily work with scandinavian lette…
Browse files Browse the repository at this point in the history
…rs on filters
  • Loading branch information
mseppae committed Jul 28, 2009
1 parent d4e0f1f commit 933013f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/routing_filter.rb
Expand Up @@ -51,7 +51,7 @@ def filters
end

def recognize_path_with_filtering(path, env)
path = path.dup # string is frozen due to memoize
path = ::URI.unescape(path.dup) # string is frozen due to memoize
filters.run :around_recognize, path, env, &lambda{ recognize_path_without_filtering(path, env) }
end
alias_method_chain :recognize_path, :filtering
Expand Down
5 changes: 5 additions & 0 deletions spec/recognition_spec.rb
Expand Up @@ -68,4 +68,9 @@
it 'recognizes the path /en-US/sections/1/articles/1 and sets a :locale param' do
should_recognize_path '/en-US/sections/1/articles/1', @article_params.update(:locale => 'en-US')
end

it 'unescapes the path for the filters' do
@set.should_receive(:recognize_path_without_filtering).with('/sections/motörhead', 'test')
@set.recognize_path('/sections/mot%C3%B6rhead', 'test')
end
end

0 comments on commit 933013f

Please sign in to comment.