Closed bangbaew closed 8 months ago
Opened a pull request at #71 , please review
Thank you for catching this up!
I pushed a fix and a test for the edge case: https://github.com/koltyakov/gosip/pull/72. The fix is a bit different from your PR, as the expectation from the function is different.
The design of checkGetRelativeURL
is:
When site URL or list/folder/etc URIs provided with incorrect values it's expected to get failures.
P.S. I'm not sure, why you providing site URL like https://www.contoso/sites/test
this is definitely sounds a misconfiguration. The base URL should be a valid web app URL.
https://www.contoso/sites/test
it isn't a valid URL, it's just an example of a site url that caused app panic, my sharepoint hostname has a port, so I tried to use this as example, sorry.
Describe the bug This is a bug in code, not a bug SharePoint Server, When site url is set to
this function works fine, but when the site url is set like this (does not have .com, i don't know how it relates)
the program panics at function
this is because the string
relativeURI
somehow becomes empty in the recursions, and[]rune(relativeURI)[0]
becomes a null value, panicking the program, so I tried debugging it this wayit panics
panic: relativeURI is empty
as expectedVersions SharePoint 2019
To Reproduce Use site url that does not have .com ex:
https://sharepointHost:8080/sites/TestSite
and call function
EnsureFolderByPath
Expected behavior No runtime panic, handling empty string correctly
Screenshots
Additional context I'll create a pull request for a workaround (handling
if relativeURI != ""
), not sure if I handled it correctly, so please review it. Thanks