« get me outta code hell

content: image: safe dimensions access - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-06-24 08:11:56 -0300
committer(quasar) nebula <qznebula@protonmail.com>2026-06-24 08:11:56 -0300
commitb46165d0f69161faa20eccb1de9f905498044d36 (patch)
treed9fb5a18a68d46911844b13d417f60ed30336954
parent3f61cd0041fde64a4bbcc04183da52a98f9e99d2 (diff)
content: image: safe dimensions access preview
-rw-r--r--src/content/dependencies/image.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index 1428de88..acf50664 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -115,7 +115,15 @@ export default {
     const originalDimensions =
       (isMissingImageFile
         ? null
-        : getDimensionsOfImagePath(mediaSrc));
+        : (() => {
+            // This errors for images which exist but don't have thumbnails
+            // generated yet. AWKWARD.....
+            try {
+              return getDimensionsOfImagePath(mediaSrc)
+            } catch {
+              return null;
+            }
+          })());
 
     const willLink =
       !isMissingImageFile &&