-
Notifications
You must be signed in to change notification settings - Fork 789
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize split_file_uri #570
Conversation
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @schneems (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
eaa590e
to
66b39ee
Compare
@@ -47,14 +47,16 @@ def test_split_file_uri | |||
parts = split_file_uri("file:///usr/local/var/github/app/assets/javascripts/application.js") | |||
assert_equal ['file', nil, '/usr/local/var/github/app/assets/javascripts/application.js', nil], parts | |||
|
|||
parts = split_file_uri("file:///C:/Documents%20and%20Settings/davris/FileSchemeURIs.doc") | |||
assert_equal ['file', nil, 'C:/Documents and Settings/davris/FileSchemeURIs.doc', nil], parts | |||
if DOSISH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need this conditional now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file:///C:/
is not a valid uri on linux
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but this test was running and passing on linux, so why add the conditional now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the previous version always stripped C:
from path
path.gsub!(/^\/([a-zA-Z]:)/, '\1'.freeze)
now we can eliminate this line, because these paths shouldn't exist on nix systems.
windows
file:///C:/Documents
vs nix
file:///usr/local
I need to add guards for these tests. On windows it's still stripped but in a more efficient way
path = path[1..-1]
this gsub is more complicated than it needs to be
related #503