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

The sourcepath isn't escaped when the deploy is called #1

Closed
anormanbmj opened this issue Nov 27, 2018 · 4 comments
Closed

The sourcepath isn't escaped when the deploy is called #1

anormanbmj opened this issue Nov 27, 2018 · 4 comments

Comments

@anormanbmj
Copy link

The extension doesn't escape the path that it passes to sfdx. If your path contains spaces the call to sfdx fails.

What it sends to sfdx:

sfdx force:source:deploy --sourcepath /Users/andy/Dropbox/clients/cpqstaging/CPQ Staging/force-app/main/default/classes/TestUtils.cls

What it should send to sfdx:

sfdx force:source:deploy --sourcepath '/Users/andy/Dropbox/clients/cpqstaging/CPQ Staging/force-app/main/default/classes/TestUtils.cls'

@anormanbmj
Copy link
Author

anormanbmj commented Nov 27, 2018

Although, reading up on escaping and node's exec, it seems like a problem lots if people are struggling with, naive escaping probably isn't the right answer after all.

shelljs/shelljs#143

@omniphx
Copy link
Owner

omniphx commented Nov 27, 2018

Thanks for reporting @anormanbmj! I just published a new version (0.0.6) with this fix in place. Seemed to be working fine when I tested out but let me know if it continues to be an issue.

@omniphx omniphx closed this as completed Nov 27, 2018
@anormanbmj
Copy link
Author

That does fix my particular issue, thank you for getting an update out so quickly.

However it isn't a general fix, that code path will still break in some cases. For example if there is a single quote in the path, which is perfectly possible and valid on MacOS for example, then it will still break. There will also be other non alpha numeric characters that are going to break it.

I also doubt that the single quote escaping is going to work cross platform in all cases. It has been a while since I did any Windows command line stuff, but I'm fairly sure you can't escape command line arguments with single quotes there.

Sadly it doesn't look like there is a quick and easy solution to fix it fully.

@omniphx
Copy link
Owner

omniphx commented Nov 27, 2018

Oh I see your point. I think the file path I'm using from VS Code's API documentation: TextDocument.fileName (https://code.visualstudio.com/docs/extensionAPI/vscode-api#TextDocument) is suppose to normalize the path string. I'll test it out with some of my co-workers using Windows machines.

For special characters.. might just let that slide for now. I'm planning on deprecating the package once this feature is included in the Salesforce extension. I think it will be Spring GA.

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