sassoftware / pyviyatools

Python command-line tools that call the SAS Viya REST APIs - for SAS administrators.
Apache License 2.0
38 stars 31 forks source link

createfolders.py fails to create folders with a trailing slash #179

Closed tomstarr closed 1 year ago

tomstarr commented 1 year ago

Hi Gerry,

I've found a wee nuance in createfolders.py and I'm hoping you could implement some error handling.

If you try to create a folder with a trailing slash at the end of the name then createfolders.py crashes with a 'http response code: 404' error.

Here's an example CSV, whereby createfolders.py would create the first two folders (/test and /test/newfolder) but would then crash.

/test,"" /test/newfolder,"" /test/newfolder2/,"" /test/newfolder3,"" /test/newfolder3/example,""

Perhaps you could implement some handling that checks for and removes any trailing slashes found on the end of folder names? Or notifies the user and tells them to remove them?

Thanks.

gerrynelson63 commented 1 year ago

Hi Tom, yes that seems like a bug. I will take care of it.

gerrynelson63 commented 1 year ago

@tomstarr I have added some code to strip the trailing slash. Try it out and I will merge it in if everything looks good.

tomstarr commented 1 year ago

Thanks Gerry, I'll get on to testing this later this week. Will keep you posted.

tomstarr commented 1 year ago

@gerrynelson63 apologies for the delay. I can confirm that the update looks good and handles this issue. Thanks!