Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Glob parameters in route ignore regexp requirements

#4970

Routes which have a regexp requirement for a glob parameter ignore that requirement. The problem is in rack-mount but the attached patch is a test case for this issue. The fix for rack-mount is here: http://github.com/pixeltrix/rack-mount/commit/4730fac50ca053c641836...

Reported by Andrew White · June 25th, 2010 @ 03:47 PM

State: resolved
Milestone: 3.0.2
Assigned to: José Valim José Valim
Importance: Medium

Activity

  1. Andrew White
    Andrew White
    • Milestone cleared.
    • State changed from new to open
    • Assigned user set to José Valim

    Patch posted inline as LH attachments appear to be broken

    From 38613c364f4025912fbd0923b2d872851db50176 Mon Sep 17 00:00:00 2001
    From: Andrew White <andyw@pixeltrix.co.uk>
    Date: Fri, 25 Jun 2010 14:38:17 +0100
    Subject: [PATCH] Failing test for whether glob parameters accept regexps
    
    ---
     actionpack/test/dispatch/routing_test.rb |   12 ++++++++++++
     1 files changed, 12 insertions(+), 0 deletions(-)
    
    diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
    index 8f43b5f..04577a1 100644
    --- a/actionpack/test/dispatch/routing_test.rb
    +++ b/actionpack/test/dispatch/routing_test.rb
    @@ -314,6 +314,8 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
               post :preview
             end
           end
    +
    +      match '/:locale/*file.:format', :to => 'files#show', :file => /path\/to\/existing\/file/
         end
       end
     
    @@ -1421,6 +1423,16 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
         end
       end
     
    +  def test_glob_parameter_accepts_regexp
    +    with_test_routes do
    +      get '/en/path/to/existing/file.html'
    +      assert_equal 200, @response.status
    +
    +      get '/en/path/to/missing/file.html'
    +      assert_equal 404, @response.status
    +    end
    +  end
    +
       private
         def with_test_routes
           yield
    -- 
    1.7.1
    

    June 25th, 2010 @ 03:49 PM

  2. Jeremy Kemper
    Jeremy Kemper
    • State changed from open to resolved

    June 25th, 2010 @ 06:25 PM

  3. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Medium

    October 15th, 2010 @ 11:01 PM