storage/curl: use MapUTF8() to reuse existing escaping code

Commit 29f78b18b1 continued.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/662
This commit is contained in:
Max Kellermann 2019-10-15 16:12:01 +02:00
parent ead208987d
commit 56cc42b752
2 changed files with 3 additions and 7 deletions

1
NEWS
View File

@ -1,6 +1,7 @@
ver 0.21.16 (not yet released) ver 0.21.16 (not yet released)
* storage * storage
- curl: request the "resourcetype" property to fix database update - curl: request the "resourcetype" property to fix database update
- curl: URL-encode more paths
* update * update
- fix crash when music_directory is not a directory - fix crash when music_directory is not a directory
* fix build with iconv() instead of ICU * fix build with iconv() instead of ICU

View File

@ -445,9 +445,7 @@ CurlStorage::GetInfo(const char *uri_utf8, gcc_unused bool follow)
{ {
// TODO: escape the given URI // TODO: escape the given URI
std::string uri = base; const auto uri = MapUTF8(uri_utf8);
uri += uri_utf8;
return HttpGetInfoOperation(*curl, uri.c_str()).Perform(); return HttpGetInfoOperation(*curl, uri.c_str()).Perform();
} }
@ -537,10 +535,7 @@ protected:
std::unique_ptr<StorageDirectoryReader> std::unique_ptr<StorageDirectoryReader>
CurlStorage::OpenDirectory(const char *uri_utf8) CurlStorage::OpenDirectory(const char *uri_utf8)
{ {
// TODO: escape the given URI std::string uri = MapUTF8(uri_utf8);
std::string uri = base;
uri += uri_utf8;
/* collection URIs must end with a slash */ /* collection URIs must end with a slash */
if (uri.back() != '/') if (uri.back() != '/')