Closed matthewpwilson closed 5 years ago
Maybe I made a mistake recommending that we encode all uss requests...but some things such as directories with spaces don't work without encoding. Maybe it's the extra slash at the beginning? If you do the request without the leading %2F e.g. /zosmf/restfiles/fs/u%2Fuser%2Ffoo.txt does it work? Maybe that's the bug @Alexandru-Dumitru any thoughts on this? Maybe we just need to not include the first character if it is a slash?
Yes, if I remove the leading %2F my REST request works, so this seems to be the culprit.
In Upload API we have this private function that is called on each path before building the z/OSMF REST call. This takes care of leading backslash. https://github.com/zowe/zowe-cli/blob/37e0fd7d63cc991e150b35a63da60163f199135a/packages/zosfiles/src/api/methods/upload/Upload.ts#L704
I think we should move it to ZosFilesUtils.ts and use it in the Delete API as well, so that this is taken care of automatically by the API, and the user can pass a full path as a command parameter.
Maybe even improve it? As I am thinking about it, it does trim just one backslash, but what if we have 2 or more? Is this something to take into consideration?
Sounds good to me to move it into a shared Util location. I think it's good to take care of multiple leading slashes too
It seems to be something to do with the URL encoding, if I make the same request to z/OSMF without the path encoded it works fine