fix(library): fix open location folder tree scroll and folder update path matching
This commit is contained in:
@@ -135,8 +135,12 @@ export function isSupportedPhoto(name: string): boolean {
|
||||
return isRawName(name) || SUPPORTED.test(name);
|
||||
}
|
||||
|
||||
export function normPath(p: string): string {
|
||||
return (p || '').replace(/\\/g, '/').replace(/\/+/g, '/').replace(/\/$/, '');
|
||||
}
|
||||
|
||||
export function photoId(folder: string, name: string): string {
|
||||
return `${folder}/${name}`;
|
||||
return `${normPath(folder)}/${normPath(name)}`;
|
||||
}
|
||||
|
||||
// The picker is Chromium-only (Chrome, Edge, Opera, Brave): Firefox and Safari
|
||||
@@ -949,11 +953,12 @@ export async function scanFolder(
|
||||
const size = preview ? jpegSize(preview) : (raw || heic || isTiff) ? null : jpegSize(bytes);
|
||||
const thumb = src ? await tile(src, size) : null;
|
||||
const taken = (await readCapturedAt(bytes)) ?? file.lastModified;
|
||||
const cut = rel.lastIndexOf('/');
|
||||
const relNorm = rel.replace(/\\/g, '/');
|
||||
const cut = relNorm.lastIndexOf('/');
|
||||
const row: LibraryPhoto = {
|
||||
id,
|
||||
folder: folder.name,
|
||||
dir: cut < 0 ? '' : rel.slice(0, cut),
|
||||
folder: normPath(folder.name),
|
||||
dir: cut < 0 ? '' : normPath(relNorm.slice(0, cut)),
|
||||
name: handle.name,
|
||||
handle,
|
||||
thumb,
|
||||
|
||||
Reference in New Issue
Block a user