« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gen-thumbs.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gen-thumbs.js b/src/gen-thumbs.js
index 85cc4fed..c2f04a00 100644
--- a/src/gen-thumbs.js
+++ b/src/gen-thumbs.js
@@ -788,18 +788,28 @@ export async function refreshThumbnailCache(cache, {mediaPath, queueSize}) {
           try {
             const filePathInMedia = path.join(mediaPath, imagePath);
 
-            if (!md5) {
+            if (md5 === null) {
               md5 = await readFileMD5(filePathInMedia);
               updatedAnything = true;
             }
 
-            if (!mtime) {
+            if (mtime === null) {
               const statResults = await stat(filePathInMedia);
               mtime = +statResults.mtime;
               updatedAnything = true;
             }
           } catch (error) {
-            if (error.code !== 'ENOENT') {
+            if (error.code === 'ENOENT') {
+              if (md5 === null) {
+                md5 = "-";
+                updatedAnything = true;
+              }
+
+              if (mtime === null) {
+                mtime = 0;
+                updatedAnything = true;
+              }
+            } else {
               throw error;
             }
           }