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:
11
src/files.rs
11
src/files.rs
@@ -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('\\', "/"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user