« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/gen-thumbs.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/gen-thumbs.js')
-rw-r--r--src/gen-thumbs.js4
1 files changed, 3 insertions, 1 deletions
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);