From 9e4a20224a2cc005775cb99b5ea888c253e48e3a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 19 Aug 2023 11:51:13 -0300 Subject: util: remove findFiles util, adapt traverse --- src/gen-thumbs.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/gen-thumbs.js') diff --git a/src/gen-thumbs.js b/src/gen-thumbs.js index 655ab6d0..2d432e4b 100644 --- a/src/gen-thumbs.js +++ b/src/gen-thumbs.js @@ -220,6 +220,7 @@ export async function clearThumbs(mediaPath, { const unsafeFiles = thumbFiles.filter(file => { if (path.extname(file) !== '.jpg') return true; if (thumbtacks.every(tack => !file.includes(tack))) return true; + if (path.relative(mediaPath, file).startsWith('../')) return true; return false; }); @@ -240,7 +241,7 @@ export async function clearThumbs(mediaPath, { await progressPromiseAll(`Removing thumbnail files`, queue( thumbFiles.map(file => async () => { try { - await unlink(path.join(mediaPath, file)); + await unlink(file); } catch (error) { if (error.code !== 'ENOENT') { errored.push(file); @@ -539,6 +540,7 @@ export async function traverseSourceImagePaths(mediaPath, {target}) { return await traverse(mediaPath, { pathStyle: (target === 'verify' ? 'posix' : 'device'), + prefixPath: '', filterFile(name) { const ext = path.extname(name); -- cgit 1.3.0-6-gf8a5