Fix escaping of file names for song URIs#52
Fix escaping of file names for song URIs#52aspettl wants to merge 5 commits intoBoddlnagg:masterfrom
Conversation
|
I just noticed that I guess I'd need to escape every segment separately for a nice URI (or use the .NET |
|
I extracted now methods for handling song URIs and put the encoding logic in there. |
| /// <returns>The "song://" URI with encoded special characters if needed.</returns> | ||
| public static Uri GetUri(string filename) | ||
| { | ||
| var escapedFilename = string.Join("/", filename.Split('/', '\\').Select(Uri.EscapeDataString)); |
There was a problem hiding this comment.
At the moment the # is the only problematic character that I know - compared to just using EscapeUriString (considering the character limitations of Windows file names). So probably it would also be sufficient to use EscapeUriString plus one additional Replace("#", "%23").
When song file names use characters that need to be escaped in URIs, then there can be problems. An example is the character
#that is automatically removed with everything behind it.song://URIs needs escaped file names (this was inconsistent so far).pppportfolio files, the file name is stored unescaped (as before)