Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 5272

Show
Ignore:
Timestamp:
10/09/06 19:14:11 (2 years ago)
Author:
minam
Message:

Fix relative URL root matching problems

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r5268 r5272  
    11*SVN* 
     2 
     3* Fix relative URL root matching problems. [Mark Imbriaco] 
    24 
    35* Fix filter skipping in controller subclasses.  #5949, #6297, #6299 [Martin Emde] 
  • trunk/actionpack/lib/action_controller/request.rb

    r4644 r5272  
    162162 
    163163      # Cut off the path to the installation directory if given 
    164       root = relative_url_root 
    165       path[0, root.length] = '' if root 
    166       path || '' 
    167     end 
    168  
     164      path.sub!(%r/^#{relative_url_root}/, '') 
     165      path || ''       
     166    end 
     167     
    169168    # Returns the path minus the web server relative installation directory. 
    170169    # This can be set with the environment variable RAILS_RELATIVE_URL_ROOT. 
  • trunk/actionpack/test/controller/request_test.rb

    r4644 r5272  
    208208    assert_equal "/hieraki/", @request.request_uri 
    209209    assert_equal "/", @request.path     
     210                                               
     211    @request.set_REQUEST_URI '/hieraki/dispatch.cgi' 
     212    @request.relative_url_root = '/hieraki' 
     213    assert_equal "/dispatch.cgi", @request.path     
     214    @request.relative_url_root = nil 
     215 
     216    @request.set_REQUEST_URI '/hieraki/dispatch.cgi' 
     217    @request.relative_url_root = '/foo' 
     218    assert_equal "/hieraki/dispatch.cgi", @request.path     
     219    @request.relative_url_root = nil 
    210220 
    211221    # This test ensures that Rails uses REQUEST_URI over PATH_INFO