From e4f41a33ef0fb7358589135389633828488c77c7 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 11 Jan 2024 13:11:17 -0400 Subject: thumbs: refreshThumbnailCache: fill in fallback values on ENOENT --- src/gen-thumbs.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src') 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; } } -- cgit 1.3.0-6-gf8a5