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

Escape all paths for ssh file changes using vim.fn.shellescape() #353

Merged
merged 4 commits into from
Apr 17, 2024

Conversation

favilo
Copy link
Contributor

@favilo favilo commented Apr 16, 2024

This should fix #352.

At least it works on my own machines.

@github-actions github-actions bot requested a review from stevearc April 16, 2024 21:36
Copy link
Owner

@stevearc stevearc left a comment

Choose a reason for hiding this comment

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

Agree that we need to escape the paths, but the problem with shellescape is that its behavior depends on the local platform. So this won't work at all if your local machine is windows, for example. Helpfully, the ssh adapter only supports remote machines with /bin/sh, so we don't have to handle multiple types of escaping.

I think we should use our own escaping logic. I believe a simple find and replace of ' with '\'' followed by wrapping the entire string in '' should do it.

Really, only escape `'` with `'\\''` so that it will:
- exit the single quote mode
- escape out a single quote character
- and get back into the single quote mode

Also format long line so linter doesn't complain
@github-actions github-actions bot requested a review from stevearc April 17, 2024 20:00
@favilo
Copy link
Contributor Author

favilo commented Apr 17, 2024

Done. I've also fixed the linting error while I was at it

@stevearc
Copy link
Owner

Awesome, thanks for the fix!

@stevearc stevearc merged commit 8bb35eb into stevearc:master Apr 17, 2024
8 checks passed
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.

bug: apostrophe's not supported in unix files over ssh
2 participants