Skip to content

ls: fix hyperlink functionality to use correct OSC 8 format and handle symlink targets#10824

Open
sylvestre wants to merge 1 commit intouutils:mainfrom
sylvestre:ls-hyp
Open

ls: fix hyperlink functionality to use correct OSC 8 format and handle symlink targets#10824
sylvestre wants to merge 1 commit intouutils:mainfrom
sylvestre:ls-hyp

Conversation

@sylvestre
Copy link
Contributor

Should fix tests/ls/hyperlink.sh

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

GNU testsuite comparison:

Congrats! The gnu test tests/ls/hyperlink is no longer failing!

1 similar comment
@github-actions
Copy link

github-actions bot commented Feb 8, 2026

GNU testsuite comparison:

Congrats! The gnu test tests/ls/hyperlink is no longer failing!

}

/// Cross-platform helper to get bytes from OsStr
fn get_os_str_bytes(os_str: &OsStr) -> Vec<u8> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using this the file is already importing uucore::os_str_as_bytes_lossy

.map(|c| {
if c.is_alphanumeric() || unencoded_chars.contains(c) {
c.to_string()
let unencoded_bytes: std::collections::HashSet<u8> = "_-.~/\\".bytes().collect();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think on windows encoding the colon breaks the windows path, might need to keep that

let output = result.stdout_str();

assert!(output.contains("caf%c3%a9.txt"));
assert!(output.contains("file%3awith%3acolons.txt"));
Copy link
Collaborator

@ChrisDryden ChrisDryden Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"));

let output = result.stdout_str();

assert!(output.contains("\x1b]8;;file://"));
assert!(!output.contains("\x07"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert!(!output.contains("\x07"));
assert!(!output.contains('\x07'));

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only clippy error

…e symlink targets

Should fix tests/ls/hyperlink.sh
Copy link
Collaborator

@ChrisDryden ChrisDryden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just waiting on the CI

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

GNU testsuite comparison:

GNU test failed: tests/tail/symlink. tests/tail/symlink is passing on 'main'. Maybe you have to rebase?
Congrats! The gnu test tests/ls/hyperlink is no longer failing!
Congrats! The gnu test tests/tail/tail-n0f is now passing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants