Make printed drive letters consistent on Windows #4038
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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