diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-01-11 13:11:17 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-01-11 14:56:21 -0400 |
commit | e4f41a33ef0fb7358589135389633828488c77c7 (patch) | |
tree | 12f01c022dd5e6290dc006ddabe1713af67612d5 | |
parent | 57ad62553315645da59c03cddf92d8957f30b58c (diff) |
thumbs: refreshThumbnailCache: fill in fallback values on ENOENT
-rw-r--r-- | src/gen-thumbs.js | 16 |
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; } } |