-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace regexp global in #url_for #8704
replace regexp global in #url_for #8704
Conversation
The literal |
@al2o3cr it should be the same thing:
|
I don't think this change is necessary. In spite of the sigil the |
@tenderlove asked me to replace the global. In the end I'm not really concerned about the change that much but what I would really like to add is test-coverage for the case. Currently you can simply remove the global and everything passes. I'll write up a test-case once I got a couple of minutes. |
馃憤 to the test. @tenderlove is there any particular reason you want to change this? |
I added a test-case but I don't have a good feeling. I ran every test there is, and collected the |
The only problem I've found is if a trailing slash is meant to be part of the query string, such as "?spareslashes=////" where I expect the value of spareslashes to be "////". I can't really think of a reason someone would do this (maybe putting another path to redirect to later?), but it seems RFC 3986 allows it (specifically section 3.4... "The characters slash ("/") and question mark ("?") may represent data within the query component."). If this is the case it would seem that the slash could conceivably come at the end of a query string somehow. What does everyone think? I've added this as a failing test case here: timraymond/rails@a18cc78 |
If it's part of the RFC I think we should support it. As you mentioned it could actually happen when you pass an URL in the query string and you have I added your test-case and updated the implementation to get it passing. @fxn could you review it? |
replace regexp global in #url_for
WIP:
I replaced
$&
with"\&"
in thesub
expression.We don't have any test-coverage for this case though. (everything passes without the reference to the match). I think we should add coverage to see what it actually does 馃槃