mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-01 07:21:17 +00:00
fix(scanner): skip library filter for empty user ID on fresh installs
When no admin user exists (fresh DB), WithAdminUser falls back to
model.User{ID: ""}. The empty ID bypassed neither the invalidUserId
("-1") check nor the IsAdmin check in applyLibraryFilter, causing
Phase 3's GetTouchedAlbums to filter by user_id="" and find zero
albums. The album refresh never ran, leaving multi-disc albums with
incomplete folder_ids from Phase 1.
Fix: treat empty user ID the same as invalidUserId in
applyLibraryFilter, skipping the library filter entirely. This is
more targeted than making the fallback user admin, which would affect
other callers like Phase 4 playlist import.
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
f48416685f
commit
91647ed46f
@ -205,8 +205,8 @@ func libraryIdFilter(_ string, value any) Sqlizer {
|
||||
func (r sqlRepository) applyLibraryFilter(sq SelectBuilder, tableName ...string) SelectBuilder {
|
||||
user := loggedUser(r.ctx)
|
||||
|
||||
// If the user is an admin, or the user ID is invalid (e.g., when no user is logged in), skip the library filter
|
||||
if user.IsAdmin || user.ID == invalidUserId {
|
||||
// If the user is an admin, or the user ID is empty/invalid (e.g., when no user is logged in), skip the library filter
|
||||
if user.IsAdmin || user.ID == "" || user.ID == invalidUserId {
|
||||
return sq
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user