Merge pull request #4616 from awsr/gallery-fix

Gallery fix
This commit is contained in:
Vladimir Mandic
2026-02-04 07:45:18 +01:00
committed by GitHub
3 changed files with 3 additions and 8 deletions
+1 -3
View File
@@ -456,11 +456,9 @@ class GalleryFile extends HTMLElement {
this.size = json.size;
this.mtime = new Date(json.mtime);
if (opts.browser_cache) {
// Store file's actual parent directory (not browsed folder) for consistent cleanup
const fileDir = this.src.replace(/\/+/g, '/').replace(/\/[^/]+$/, '');
await idbAdd({
hash: this.hash,
folder: fileDir,
folder: this.folder,
file: this.name,
size: this.size,
mtime: this.mtime,
+1 -4
View File
@@ -185,10 +185,7 @@ async function idbFolderCleanup(keepSet, folder, signal) {
throw new Error('IndexedDB cleaning function must be told the current active folder');
}
// Use range query to match folder and all its subdirectories
const folderNormalized = folder.replace(/\/+/g, '/').replace(/\/$/, '');
const range = IDBKeyRange.bound(folderNormalized, `${folderNormalized}\uffff`, false, true);
let removals = new Set(await idbGetAllKeys('folder', range));
let removals = new Set(await idbGetAllKeys('folder', folder));
removals = removals.difference(keepSet); // Don't need to keep full set in memory
const totalRemovals = removals.size;
if (signal.aborted) {
+1 -1
Submodule wiki updated: e4b53a6d36...a678731c5d