koltyakov / gosip

⚡️ SharePoint SDK for Go
https://go.spflow.com
MIT License
140 stars 32 forks source link

Support special characters in EnsureFolder #63

Closed whiteboxsolutions closed 11 months ago

whiteboxsolutions commented 11 months ago

Is your feature request related to a problem? Please describe. The current EnsureFolder method doesn't allow for the use of decodedURL (in the same vein as GetFolderByPath or GetFileByPath). This results in an inability to ensure that folders including special characters exist.

Describe the solution you'd like Change the method to use GetFolderByPath instead of GetFolder

Submitting PR momentarily

koltyakov commented 11 months ago

Thank you. I will check. Yet from the first glance the PR doesn't look OK (some overwrite of Folders with Folder which feels weird and backward compatibility breaking is happening in the PR).

What special characters are you trying to use? I'd appreciate a few samples.

I'll better add test cases with special chars and make sure it works to start with.

whiteboxsolutions commented 11 months ago

Ah, it looks like my commit pulled in a bunch of pending changes on the dev branch - the only changes I made were to lines 189 and 209

I'll revoke and resubmit tonight

The special characters I'm looking at are # and %

/sites/site/Shared Documents/Test #2/frame %.txt for example

koltyakov commented 11 months ago

The special characters I'm looking at are # and %

Thank you! I'll add them to tests and check it out over the weekend.

koltyakov commented 11 months ago

Hey @whiteboxsolutions,

Please try web.EnsureFolderByPath method it should support special characters in folder paths.

I kept web.EnsureFolder as is for backwards compatibility with SharePoint 2013.

koltyakov commented 11 months ago

Going to close, feel free to reopen if you have questions or I miss something during testing.