Commit 03f99dd2 authored by Max Kellermann's avatar Max Kellermann

db/update/Walk: use GetFilenameSuffix() instead of uri_get_suffix()

Unlike GetFilenameSuffix(), uri_get_suffix() removes the query string first, which breaks file names with question marks in the name. Therefore, uri_get_suffix() shall only be applied to remote URIs. Closes https://github.com/MusicPlayerDaemon/MPD/issues/1316
parent bfb1b641
...@@ -3,6 +3,7 @@ ver 0.23.3 (not yet released) ...@@ -3,6 +3,7 @@ ver 0.23.3 (not yet released)
- add optional position parameter to "add" and "playlistadd" - add optional position parameter to "add" and "playlistadd"
- allow range in "playlistdelete" - allow range in "playlistdelete"
* database * database
- fix scanning files with question mark in the name
- inotify: fix use-after-free bug - inotify: fix use-after-free bug
* output * output
- alsa: add option "stop_dsd_silence" to work around DSD DAC noise - alsa: add option "stop_dsd_silence" to work around DSD DAC noise
......
...@@ -224,10 +224,12 @@ GetChromaprintCommand::DecodeFile(std::string_view suffix, InputStream &is, ...@@ -224,10 +224,12 @@ GetChromaprintCommand::DecodeFile(std::string_view suffix, InputStream &is,
inline void inline void
GetChromaprintCommand::DecodeFile() GetChromaprintCommand::DecodeFile()
{ {
const auto suffix = uri_get_suffix(uri); const char *_suffix = PathTraitsUTF8::GetFilenameSuffix(uri.c_str());
if (suffix.empty()) if (_suffix == nullptr)
return; return;
const std::string_view suffix{_suffix};
InputStreamPtr input_stream; InputStreamPtr input_stream;
try { try {
......
...@@ -188,8 +188,8 @@ UpdateWalk::UpdateRegularFile(Directory &directory, ...@@ -188,8 +188,8 @@ UpdateWalk::UpdateRegularFile(Directory &directory,
const char *name, const char *name,
const StorageFileInfo &info) noexcept const StorageFileInfo &info) noexcept
{ {
const auto suffix = uri_get_suffix(name); const char *suffix = PathTraitsUTF8::GetFilenameSuffix(name);
if (suffix.empty()) if (suffix == nullptr)
return false; return false;
return UpdateSongFile(directory, name, suffix, info) || return UpdateSongFile(directory, name, suffix, info) ||
......
...@@ -395,10 +395,12 @@ TryContainerDecoder(DecoderBridge &bridge, Path path_fs, ...@@ -395,10 +395,12 @@ TryContainerDecoder(DecoderBridge &bridge, Path path_fs,
static bool static bool
decoder_run_file(DecoderBridge &bridge, const char *uri_utf8, Path path_fs) decoder_run_file(DecoderBridge &bridge, const char *uri_utf8, Path path_fs)
{ {
const auto suffix = uri_get_suffix(uri_utf8); const char *_suffix = PathTraitsUTF8::GetFilenameSuffix(uri_utf8);
if (suffix.empty()) if (_suffix == nullptr)
return false; return false;
const std::string_view suffix{_suffix};
InputStreamPtr input_stream; InputStreamPtr input_stream;
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment