Skip to content
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

Make printed drive letters consistent on Windows #4038

Merged
merged 1 commit into from Oct 29, 2020

Conversation

deivid-rodriguez
Copy link
Member

@deivid-rodriguez deivid-rodriguez commented Oct 26, 2020

What was the end-user or developer problem that led to this PR?

Sometimes driver letters are printed with inconsistent casing on Windows. This is unexpected and sometimes can cause surprising test failures, like the ones I'm unskipping here and like https://github.com/rubygems/rubygems/runs/1310494829?check_suite_focus=true.

The problem is that the helper that removes credentials from URLs for display, does the following when passed an actual file with a Windows driver letter.

URI("A:/foo").to_s
=> "a:/foo"

Namely, the uri library interprets the drive letter as the scheme and downcases it, causing the inconsistency.

What is your fix for the problem, implemented in this PR?

My fix is to make the helper return the original argument when the string given is an actual file, since I believe in that case we can safely assume it includes no credentials.

An alternative would be to wrap the passed string with file:// to give it a proper scheme, and then remove it after cleanup and before returning from the method. However, the initial approach is simpler and I think it's also safe.

Make sure he following tasks are checked

@deivid-rodriguez deivid-rodriguez force-pushed the fix_drive_letter_windows_inconsistencies branch from ab3f891 to ae4ac4d Compare October 26, 2020 20:16
@deivid-rodriguez deivid-rodriguez force-pushed the fix_drive_letter_windows_inconsistencies branch from ae4ac4d to 0d80d5e Compare October 27, 2020 10:59
@deivid-rodriguez
Copy link
Member Author

Ready now, added a description!

@deivid-rodriguez deivid-rodriguez merged commit 3982b12 into master Oct 29, 2020
@deivid-rodriguez deivid-rodriguez deleted the fix_drive_letter_windows_inconsistencies branch October 29, 2020 10:33
deivid-rodriguez added a commit that referenced this pull request Dec 7, 2020
…sistencies

Make printed drive letters consistent on Windows

(cherry picked from commit 3982b12)
deivid-rodriguez added a commit that referenced this pull request Dec 7, 2020
…sistencies

Make printed drive letters consistent on Windows

(cherry picked from commit 3982b12)
deivid-rodriguez added a commit that referenced this pull request Dec 7, 2020
…sistencies

Make printed drive letters consistent on Windows

(cherry picked from commit 3982b12)
deivid-rodriguez added a commit that referenced this pull request Dec 7, 2020
…sistencies

Make printed drive letters consistent on Windows

(cherry picked from commit 3982b12)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants