Enable remote to work with spaces and quotes in path #1611
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.
Should address #1609, without replacing
exec
withspawn
as #1610 did.Escaping any argument could be a rather complex thing, but here we only need to handle paths, and that simplifies the solution, because:
"
in the path we can always just wrap it in"
s"
is not allowed in file names so with this we don't need to think about weird ways of escaping (like^"
or""
)'
we can wrap it in'
s and call it a day"
in shell by\"
, so if both"
and'
is present in the path, we replace occurrences of"
with\"
and wrap the result in'
Also note that BackstopJS remote so far would simply fail for anyone with either
'
or"
in their path, just like with spaces, so basically no matter what thewrapPath()
function does, it cannot really make things worse for them.On the other hand I could make
wrapPath()
return the path without any wrapping if it did not contain a space, that way ensuring exact same behaviour as so far, but with that it'd still be broken for'
and"
in the path, so this is a bit more risky, but this way it'll not break with quotation marks in the paths neither.