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

fix(output): quote symbolic links correctly when their destinations contain spaces #716

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

zedseven
Copy link
Contributor

@zedseven zedseven commented Dec 9, 2023

There's an issue with the way symlinks are quoted when their destination has spaces in the name.

Below is a set of test cases that demonstrates the problem:

λ eza -l bug-test
.rw-r--r-- 0 zacc  9 Dec 17:53 'file with spaces'
lrwxrwxrwx - zacc  9 Dec 17:54 'symlink-to-dest-with-spaces -> /tmp/file with spaces' # <-- this one
lrwxrwxrwx - zacc  9 Dec 17:53 symlink-without-spaces -> /tmp/test
lrwxrwxrwx - zacc  9 Dec 18:24 ''symlink with spaces to dest with spaces' -> /tmp/file with spaces' # <-- and this one
lrwxrwxrwx - zacc  9 Dec 17:53 'symlink with spaces' -> /tmp/test

In symlink-to-dest-with-spaces, the link has no spaces, but the destination does. eza quoted the entire link display, instead of just the destination.

In symlink with spaces to dest with spaces, the link and destination have spaces. eza quoted the link and then also the entire link display, instead of quoting each separately.

The issue is caused by the fact that the escape function always inserts the starting quote at the very beginning of the finished string, instead of only inserting it before the new part.

It seems to have been introduced in #318.

@cafkafk cafkafk self-requested a review December 12, 2023 08:24
Copy link
Member

@cafkafk cafkafk left a comment

Choose a reason for hiding this comment

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

Nice, thanks for fixing this!

Integration tests pass, and my testing of the expected behavior indicates that this is working as expected, without introducing any regressions. Merge incoming!

@cafkafk cafkafk merged commit 54abab7 into eza-community:main Dec 12, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants