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

dired-open-xdg: Argument quotes must be escaped #224

Open
rythoris opened this issue Oct 9, 2024 · 2 comments
Open

dired-open-xdg: Argument quotes must be escaped #224

rythoris opened this issue Oct 9, 2024 · 2 comments

Comments

@rythoris
Copy link

rythoris commented Oct 9, 2024

Quoting the file-name using concatenation is unsafe, and sometimes it doesn't work when there is a single-quote and spaces in the file-name. I would recommend the following changes for dired-open-xdg which uses the Emacs 29.1 shell-quote-argument function:

   (interactive)
   (if (executable-find "xdg-open")
       (let ((file (ignore-errors (dired-get-file-for-visit))))
-        (call-process-shell-command (concat "xdg-open '" (file-truename file) "'"))
+        (call-process-shell-command (concat "xdg-open " (shell-quote-argument
+                                                         (file-truename file))))
     nil)))

Quoting in this case is not that complicated and can be done using basic substitution if you want to keep it backward compatible.

@ika-twb
Copy link

ika-twb commented Oct 28, 2024

I had the same problem! Could you check and see if #225 works for you? I did only minimal testing since it was just a simple change.

@rythoris
Copy link
Author

@ika-twb yeah, that should do the trick...

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

No branches or pull requests

2 participants