This repository has been archived by the owner on Sep 13, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from carlosantoniodasilva/script-name-root-url
Fix to not allow trailing slash on script name when matching
- Loading branch information
Showing
2 changed files
with
22 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ def call env | |
@params_key) | ||
|
||
unless route.path.anchored | ||
env['SCRIPT_NAME'] = script_name.to_s + match.to_s | ||
env['SCRIPT_NAME'] = (script_name.to_s + match.to_s).chomp('/') | ||
env['PATH_INFO'] = match.post_match | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
carlosantoniodasilva
Member
|
||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The
PATH_INFO
environment variable is missing it's leading slash here - e.g. the following assertion will fail in the test below:The best solution for 1-0-stable is to just run it through
normalize_path
and this is essentially what happens for mounted engines, however mounted rack apps won't work, e.g. aget '/weblog'
in a Sinatra app will fail. Ideally for master I'd like to have a stab at implementing #17 and eliminatingnormalize_path
- I'll discuss in that ticket what I think the semantics should be.