diff --git a/padrino-core/lib/padrino-core/path_router/matcher.rb b/padrino-core/lib/padrino-core/path_router/matcher.rb index 0f5b947e0..fd9816f05 100644 --- a/padrino-core/lib/padrino-core/path_router/matcher.rb +++ b/padrino-core/lib/padrino-core/path_router/matcher.rb @@ -21,7 +21,7 @@ def initialize(path, options = {}) def match(pattern) if match_data = handler.match(pattern) match_data - elsif mustermann? && pattern != "/" && pattern.end_with?("/") + elsif pattern != "/" && pattern.end_with?("/") handler.match(pattern[0..-2]) end end diff --git a/padrino-core/test/test_routing.rb b/padrino-core/test/test_routing.rb index 5aab6e293..bc84aaf97 100644 --- a/padrino-core/test/test_routing.rb +++ b/padrino-core/test/test_routing.rb @@ -156,6 +156,16 @@ def match(string) assert_equal "My lucky number: 99 99", body end + it 'should ignore trailing slashes' do + mock_app do + get(%r./trailing.) { "slash" } + end + get "/trailing" + assert_equal "slash", body + get "/trailing/" + assert_equal "slash", body + end + it 'should accept regexp routes with generate with :generate_with' do mock_app do get(%r{/fob|/baz}, :name => :foo, :generate_with => '/fob') { "regexp" }