Repository navigation
🐛 Quote the file path in the Open File action on Linux - #1603
Merged
Schneegans merged 3 commits intoNov 6, 2026
Merged
Conversation
Schneegans
approved these changes
Nov 6, 2026
Schneegans
left a comment
Contributor
There was a problem hiding this comment.
Thank you very much! Looks like a reasonable improvement 😄
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.
On Linux the Open File action builds the command
xdg-open "${action.path}", andexec()runs it through a shell (spawn(command, [], { shell: true })). Double quotes do not stop the shell from expanding$, backticks or\, and a"in the path ends the quoted string early. For an Open File item pointing at:/home/user/$HOME-notes.txt, the shell expands$HOMEand the wrong path is opened./home/user/Budget "2026".pdf, the shell joins it toBudget 2026.pdf./home/user/$(touch marker).txt, thetouchcommand is run.This wraps the path in single quotes and escapes any single quote inside it (as
'\''), so the path reachesxdg-openunchanged. macOS and Windows useshell.openPathand are not affected.I added
test/unit-tests/open-file.spec.ts. It puts a fakexdg-openfirst on the PATH, runs the action, and checks that the script receives the path exactly as given (plain, spaces,$HOME, double quote, single quote, backtick, backslash). It also checks that a$(touch ...)in the path does not create the marker file. The spec is skipped on non-Linux platforms. I also added a line to the Fixed section of the changelog.I did not run anything locally. I checked it in CI on my fork:
AssertionError: expected '/home/user//home/runner-notes.txt' to equal '/home/user/$HOME-notes.txt',expected '/home/user/Budget 2026.pdf' to equal '/home/user/Budget "2026".pdf', andexpected true to equal falsefor the marker file. Run: https://github.com/ChandraChaan/kando/actions/runs/41588416222. The End-to-End Tests job also failed in that run, incli.spec.tsandsettings-persistence.spec.tswithunexpected value "no-transitions hidden". Those specs do not touch this code and they passed on the fix commit, so I think they are flaky.