Hi,
Trouble with using the spo add file command for a file name with a single quote. We tried escaping it with \ but it didn't work.
example)
o365 spo file add --webUrl URL --folder FOLDER --path /c/Users/me/Downloads/fileWithSingleQuote\'s.txt
Thanks
Which shell and OS are you using so that we can reproduce the issue and look for a solution?
We are testing in git bash on Windows 10
Tested on using zsh on MacOS and confirmed that attempting to upload a document with apostrophe in the filename throws an error.
o365 spo file add --webUrl https://tenant.sharepoint.com --folder 'Shared Documents' --path /Users/user/Projects/TEST'FILE.txt
Error: {"odata.error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The expression \"web/GetFolderByServerRelativeUrl('/Shared Documents')/Files/Add(url='TEST'FILE.txt', overwrite=true)\" is not valid."}}}`
Wrapping path in quotes (single or double) results in Specified path of the file to add does not exist message
Thanks for looking into it @garrytrinder. @munchkin1, just to verify, are you seeing the same error as @garrytrinder?
@garrytrinder if you're working on it, see if replacing ' with '' would help. I vaguely recall a similar issue in MS Graph where it was the case.
@waldekmastykarz that was the fix, see #1181 馃槉
Yes, confirmed we see the same "_Microsoft.SharePoint.Client.InvalidClientQueryException_" error @garrytrinder posted.
The fix for this issue is available in the latest beta which you can get through npm i -g @pnp/office365-cli@next. Once again, thank you for reporting 馃憤
Most helpful comment
Yes, confirmed we see the same "_Microsoft.SharePoint.Client.InvalidClientQueryException_" error @garrytrinder posted.