From 395bf34a91d9c551985229a1ec8b6f564a28067b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 30 Apr 2023 08:40:40 +0200 Subject: [PATCH] db/update/Archive: move check to IsAcceptableFilename() --- src/db/update/Archive.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/db/update/Archive.cxx b/src/db/update/Archive.cxx index 9f5829f2c..9dee7dfdf 100644 --- a/src/db/update/Archive.cxx +++ b/src/db/update/Archive.cxx @@ -35,6 +35,13 @@ LockFindSong(Directory &directory, std::string_view name) noexcept return directory.FindSong(name); } +[[gnu::pure]] +static bool +IsAcceptableFilename(std::string_view name) noexcept +{ + return !name.empty(); +} + void UpdateWalk::UpdateArchiveTree(ArchiveFile &archive, Directory &directory, std::string_view name) noexcept @@ -48,7 +55,7 @@ UpdateWalk::UpdateArchiveTree(ArchiveFile &archive, Directory &directory, //create directories first UpdateArchiveTree(archive, *subdir, rest); } else { - if (name.empty()) + if (!IsAcceptableFilename(name)) return; //add file