From 0dc4b6f7284dfe815da87d12cdac025849d06b01 Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Mon, 15 Sep 2025 20:18:39 +0800 Subject: [PATCH] refactor(showcase): improve custom image identification logic in renderMediaItem and findLocalFile functions --- static/js/components/shared/showcase/MediaRenderers.js | 2 -- static/js/components/shared/showcase/ShowcaseView.js | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/static/js/components/shared/showcase/MediaRenderers.js b/static/js/components/shared/showcase/MediaRenderers.js index b8ef109f..9f1a6726 100644 --- a/static/js/components/shared/showcase/MediaRenderers.js +++ b/static/js/components/shared/showcase/MediaRenderers.js @@ -75,8 +75,6 @@ export function generateImageWrapper(media, heightPercent, shouldBlur, nsfwText, data-remote-src="${remoteUrl}" data-nsfw-level="${nsfwLevel}" alt="Preview" - crossorigin="anonymous" - referrerpolicy="no-referrer" width="${media.width}" height="${media.height}" class="lazy ${shouldBlur ? 'blurred' : ''}"> diff --git a/static/js/components/shared/showcase/ShowcaseView.js b/static/js/components/shared/showcase/ShowcaseView.js index e5ccfae0..b4b96b0f 100644 --- a/static/js/components/shared/showcase/ShowcaseView.js +++ b/static/js/components/shared/showcase/ShowcaseView.js @@ -191,7 +191,7 @@ function renderMediaItem(img, index, exampleFiles) { ); // Determine if this is a custom image (has id property) - const isCustomImage = Boolean(img.id); + const isCustomImage = Boolean(typeof img.id === 'string' && img.id); // Create the media control buttons HTML const mediaControlsHtml = ` @@ -235,7 +235,7 @@ function findLocalFile(img, index, exampleFiles) { let localFile = null; - if (img.id) { + if (typeof img.id === 'string' && img.id) { // This is a custom image, find by custom_ const customPrefix = `custom_${img.id}`; localFile = exampleFiles.find(file => file.name.startsWith(customPrefix));