OneDrive / onedrive-sdk-csharp

OneDrive SDK for C#! https://dev.onedrive.com
Other
295 stars 145 forks source link

ItemWithPath can't handle "invalid characters" #236

Open tvandijck opened 7 years ago

tvandijck commented 7 years ago

in the example here

.ItemWithPath(parentItem.ParentReference.Path + "/" + parentItem.Name + "/relative/path")

should be fixed to:

.ItemWithPath(parentItem.ParentReference.Path + "/" + Uri.EscapeDataString(parentItem.Name + "/relative/path"))

or, the ItemWithPath API itself should handle the right escaping.

Without the escaping I was getting exceptions on invalid characters:

Code: invalidRequest
Throw site: 5669.22a3
Message: Path (/LiveFolders/Pictures Shanon/2004-01-01, Crossfit ) contains invalid trailing character.

Inner error
Code: nameContainsInvalidCharacters

I tried:

but it appears only the Uri.EscapeDataString covers all cases.