This project is archived and is in readonly mode.

#4970 ✓resolved
Andrew White

Glob parameters in route ignore regexp requirements

Reported by Andrew White | June 25th, 2010 @ 03:47 PM | in 3.0.2

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...

Comments and changes to this ticket

  • Andrew White

    Andrew White June 25th, 2010 @ 03:49 PM

    • 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
    
  • Jeremy Kemper

    Jeremy Kemper June 25th, 2010 @ 06:25 PM

    • State changed from “open” to “resolved”
  • Jeremy Kemper

    Jeremy Kemper October 15th, 2010 @ 11:01 PM

    • Milestone set to 3.0.2
    • Importance changed from “” to “Medium”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages