fix: normalize rel_path separators in non-recursive /photos listing

On Windows, strip_prefix preserves backslashes, so the non-recursive
branch was looking up tags for 'Melissa\img1.jpg' while tagged_photo
stores 'Melissa/img1.jpg' — every file was filtered out. Normalize to
'/' to match the watcher and populate_knowledge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cameron
2026-04-18 09:53:51 -04:00
committed by cameron
parent e6ee38edec
commit 7becbc0737

View File

@@ -568,7 +568,14 @@ pub async fn list_photos<TagD: TagDao, FS: FileSystemAccess>(
path.display()
)
});
let relative_str = relative.to_str().unwrap().to_string();
// Normalize separators to '/' so downstream
// lookups (tags, EXIF, insights) that store
// rel_paths with forward slashes still match
// on Windows.
let relative_str = relative
.to_str()
.unwrap()
.replace('\\', "/");
if md.is_file() {
files.push(relative_str);
@@ -589,7 +596,7 @@ pub async fn list_photos<TagD: TagDao, FS: FileSystemAccess>(
path.display()
)
});
files.push(relative.to_str().unwrap().to_string());
files.push(relative.to_str().unwrap().replace('\\', "/"));
}
}
}