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.

Slash gets escaped when globbing a route

#5135

Given a route defined as:

  match '*section_path' => "sections#show"

When I specify:

  def test "globbed route"
    assert_routing('/company/about', { :controller => 'pages', :action => 'show', :path => 'company/about' })
  end

Then I receive an error stating 'The generated path <"/about%2Fabout-company"> did not match <"/about/about-company">.'

Reported by Brian Rose · July 16th, 2010 @ 10:40 PM

State: resolved
Milestone: none
Assigned to: José Valim José Valim
Importance: none

Activity

  1. Brian Rose
    Brian Rose
    • Tag changed from tests actionpack, glob, router to rails 3, tests actionpack, glob, router

    July 17th, 2010 @ 11:31 PM

  2. eagle.anton (at gmail)
    eagle.anton (at gmail)
    • Tag changed from rails 3, tests actionpack, glob, router to rails 3, slash escape, tests actionpack, glob, router

    Confirm this but not only for globbing.

    For example this route:

    match "/:path" => "pages#show", :constraints => {:path => /.+(\/.+)*/ }
    
    assert_routing '/directory/filename', :controller => 'pages', :action => 'show', :path => 'directory/filename'
    
    The generated path <"/directory%2Ffilename"> did not match <"/directory/filename">
    

    Patch solves the problem.

    July 21st, 2010 @ 02:23 PM

  3. David Chelimsky
    David Chelimsky
    • Assigned user set to José Valim
    • Tag changed from rails 3, slash escape, tests actionpack, glob, router to rails 3, slash escape, tests actionpack, glob, patch, router

    July 21st, 2010 @ 02:35 PM

  4. Repository
    Repository
    • State changed from new to resolved

    (from [622092d33e8d326217ab1ed6138e2c572c95b8ba]) Fixed a globbed route issue where slashes were being escaped, causing assert_routing to fail. [#5135 state:resolved]

    Signed-off-by: José Valim jose.valim@gmail.com
    http://github.com/rails/rails/commit/622092d33e8d326217ab1ed6138e2c...

    July 21st, 2010 @ 09:19 PM

  5. David Chelimsky
    David Chelimsky

    Great. Thank you, José!

    July 21st, 2010 @ 09:21 PM