diff options
author | Max Kellermann <max@musicpd.org> | 2021-07-16 07:52:54 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2021-07-16 08:31:58 +0200 |
commit | 19a44076cfd31c4c6e2c58d0efc86244970fc2e8 (patch) | |
tree | 954fe94e6e2223b0d4602a2a5f49f6e1485f4c54 | |
parent | 809a18913a179c1581cea463daaac3cbdae2231f (diff) |
command/file: pass directory uri to read_stream_art()
-rw-r--r-- | src/command/FileCommands.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx index e5638a10a..52d8abae2 100644 --- a/src/command/FileCommands.cxx +++ b/src/command/FileCommands.cxx @@ -187,10 +187,9 @@ find_stream_art(std::string_view directory, Mutex &mutex) } static CommandResult -read_stream_art(Response &r, const char *uri, size_t offset) +read_stream_art(Response &r, const std::string_view art_directory, + size_t offset) { - const auto art_directory = PathTraitsUTF8::GetParent(uri); - // TODO: eliminate this const_cast auto &client = const_cast<Client &>(r.GetClient()); @@ -252,7 +251,8 @@ read_db_art(Client &client, Response &r, const char *uri, const uint64_t offset) return CommandResult::ERROR; } std::string uri2 = storage->MapUTF8(uri); - return read_stream_art(r, uri2.c_str(), offset); + return read_stream_art(r, PathTraitsUTF8::GetParent(uri2.c_str()), + offset); } #endif @@ -273,7 +273,10 @@ handle_album_art(Client &client, Request args, Response &r) switch (located_uri.type) { case LocatedUri::Type::ABSOLUTE: case LocatedUri::Type::PATH: - return read_stream_art(r, located_uri.canonical_uri, offset); + return read_stream_art(r, + PathTraitsUTF8::GetParent(located_uri.canonical_uri), + offset); + case LocatedUri::Type::RELATIVE: #ifdef ENABLE_DATABASE return read_db_art(client, r, located_uri.canonical_uri, offset); |