Fix Windows hyperlinks for paths with spaces#1872
Merged
tmccombs merged 5 commits intosharkdp:masterfrom Jan 16, 2026
Merged
Conversation
Fixes sharkdp#1843 Changed the host() function for Windows to return '/' instead of '' to generate RFC 3986 compliant file URLs with three slashes. Before: file://C:/test/hi%20there.txt (broken) After: file:///C:/test/hi%20there.txt (works) This fixes hyperlinks failing on Windows when file paths contain spaces or other characters that require percent-encoding.
tmccombs
requested changes
Jan 15, 2026
Collaborator
tmccombs
left a comment
There was a problem hiding this comment.
It looks like some tests are failing. Probably the tests for hyperlinks need to be updated.
Contributor
Author
checking it immediately |
Contributor
Author
|
Thanks for the heads-up @tmccombs updated the hyperlink test and pushed. CI ran successfully now. |
tmccombs
approved these changes
Jan 16, 2026
Collaborator
tmccombs
left a comment
There was a problem hiding this comment.
We should probably also add an entry to the changelog as well (sorry, I should have mentioned that in my previous review), but looks good.
Collaborator
|
Thanks for fixing this! |
Contributor
Author
Good call @tmccombs I’ll add a changelog entry and push an update shortly. Thanks |
tmccombs
approved these changes
Jan 16, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1843
This PR fixes hyperlink generation on Windows when file paths contain spaces or other characters that require percent-encoding.
Problem
On Windows, fd was generating file URLs like
file://C:/test/hi%20there.txt(2 slashes) which don't work in Windows Terminal. Paths without spaces worked fine, but paths with spaces failed to open.Solution
Changed the
host()function for Windows to return"/"instead of"", generating RFC 3986 compliant URLs with three slashes:file:///C:/test/hi%20there.txtChanges
src/hyperlink.rsline 61 to return"/"for Windowsfile:///+ drive pathTesting
The fix addresses the exact issue reported:
file://C:/test/hi%20there.txt❌ (broken)file:///C:/test/hi%20there.txt✅ (works)Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=105917501