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
1 changed files with 8 additions and 1 deletions

View File

@ -51,6 +51,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,
const char *name) noexcept
@ -65,7 +72,7 @@ UpdateWalk::UpdateArchiveTree(ArchiveFile &archive, Directory &directory,
//create directories first
UpdateArchiveTree(archive, *subdir, tmp + 1);
} else {
if (StringIsEmpty(name))
if (!IsAcceptableFilename(name))
return;
//add file