db/update/Archive: move check to IsAcceptableFilename()

This commit is contained in:
Max Kellermann 2023-04-30 08:40:40 +02:00
parent 75a39ed279
commit 16a99804de

View File

@ -51,6 +51,13 @@ LockFindSong(Directory &directory, std::string_view name) noexcept
return directory.FindSong(name); return directory.FindSong(name);
} }
[[gnu::pure]]
static bool
IsAcceptableFilename(std::string_view name) noexcept
{
return !name.empty();
}
void void
UpdateWalk::UpdateArchiveTree(ArchiveFile &archive, Directory &directory, UpdateWalk::UpdateArchiveTree(ArchiveFile &archive, Directory &directory,
const char *name) noexcept const char *name) noexcept
@ -65,7 +72,7 @@ UpdateWalk::UpdateArchiveTree(ArchiveFile &archive, Directory &directory,
//create directories first //create directories first
UpdateArchiveTree(archive, *subdir, tmp + 1); UpdateArchiveTree(archive, *subdir, tmp + 1);
} else { } else {
if (StringIsEmpty(name)) if (!IsAcceptableFilename(name))
return; return;
//add file //add file