ls: fix hyperlink functionality to use correct OSC 8 format and handle symlink targets#10824
Merged
ChrisDryden merged 2 commits intouutils:mainfrom Feb 9, 2026
Merged
ls: fix hyperlink functionality to use correct OSC 8 format and handle symlink targets#10824ChrisDryden merged 2 commits intouutils:mainfrom
ChrisDryden merged 2 commits intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
1 similar comment
|
GNU testsuite comparison: |
ChrisDryden
reviewed
Feb 8, 2026
src/uu/ls/src/ls.rs
Outdated
| } | ||
|
|
||
| /// Cross-platform helper to get bytes from OsStr | ||
| fn get_os_str_bytes(os_str: &OsStr) -> Vec<u8> { |
Collaborator
There was a problem hiding this comment.
Instead of using this the file is already importing uucore::os_str_as_bytes_lossy
ChrisDryden
reviewed
Feb 8, 2026
src/uu/ls/src/ls.rs
Outdated
| .map(|c| { | ||
| if c.is_alphanumeric() || unencoded_chars.contains(c) { | ||
| c.to_string() | ||
| let unencoded_bytes: std::collections::HashSet<u8> = "_-.~/\\".bytes().collect(); |
Collaborator
There was a problem hiding this comment.
I think on windows encoding the colon breaks the windows path, might need to keep that
ChrisDryden
reviewed
Feb 8, 2026
| let output = result.stdout_str(); | ||
|
|
||
| assert!(output.contains("caf%c3%a9.txt")); | ||
| assert!(output.contains("file%3awith%3acolons.txt")); |
Collaborator
There was a problem hiding this comment.
I think this one will have to be platform dependent for windows:
Suggested change
| assert!(output.contains("file%3awith%3acolons.txt")); | |
| #[cfg(not(target_os = "windows"))] | |
| assert!(output.contains("file%3awith%3acolons.txt")); | |
| #[cfg(target_os = "windows")] | |
| assert!(output.contains("file:with:colons.txt")); |
ChrisDryden
reviewed
Feb 8, 2026
tests/by-util/test_ls.rs
Outdated
| let output = result.stdout_str(); | ||
|
|
||
| assert!(output.contains("\x1b]8;;file://")); | ||
| assert!(!output.contains("\x07")); |
Collaborator
There was a problem hiding this comment.
Suggested change
| assert!(!output.contains("\x07")); | |
| assert!(!output.contains('\x07')); |
Collaborator
There was a problem hiding this comment.
This is the only clippy error
ChrisDryden
approved these changes
Feb 8, 2026
Collaborator
ChrisDryden
left a comment
There was a problem hiding this comment.
Just waiting on the CI
|
GNU testsuite comparison: |
…e symlink targets Should fix tests/ls/hyperlink.sh
Collaborator
|
Had to update because the CI wasn't starting |
|
GNU testsuite comparison: |
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.
Should fix tests/ls/hyperlink.sh