From f90979a2b0d4e42ca4d7d7eeec67848fd4431e52 Mon Sep 17 00:00:00 2001 From: Desktop Date: Wed, 12 Nov 2025 10:57:34 +0500 Subject: [PATCH] sad --- .gitignore | 7 +++++++ .../components/common/ContentImageCell.tsx | 20 ++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..42051dbd --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# AI Generated Images - Do not commit generated images +frontend/public/images/ai-images/ +**/ai-images/ + +# Also ignore in dist/build output +frontend/dist/images/ai-images/ + diff --git a/frontend/src/components/common/ContentImageCell.tsx b/frontend/src/components/common/ContentImageCell.tsx index 68a8655d..07e55967 100644 --- a/frontend/src/components/common/ContentImageCell.tsx +++ b/frontend/src/components/common/ContentImageCell.tsx @@ -25,6 +25,16 @@ interface ContentImageCellProps { export default function ContentImageCell({ image, maxPromptLength = 100 }: ContentImageCellProps) { const [showFullPrompt, setShowFullPrompt] = useState(false); + // Check if image_path is a valid local file path (not a URL) + const isValidLocalPath = (imagePath: string): boolean => { + // Reject URLs (http:// or https://) + if (imagePath.startsWith('http://') || imagePath.startsWith('https://')) { + return false; + } + // Must contain 'ai-images' to be a valid local path + return imagePath.includes('ai-images'); + }; + // Convert local file path to web-accessible URL const getLocalImageUrl = (imagePath: string): string => { // If path contains 'ai-images', convert to web URL @@ -97,15 +107,15 @@ export default function ContentImageCell({ image, maxPromptLength = 100 }: Conte {image.status === 'generated' && (
- {/* Always load from image_path - no fallback */} - {image.image_path && image.image_path.trim() ? ( + {/* Only use image_path if it's a valid local file path (not a URL) */} + {image.image_path && image.image_path.trim() && isValidLocalPath(image.image_path) ? ( <> {prompt { - // Show error placeholder if local image fails (no fallback to image_url) + // Show empty placeholder if local image fails to load const target = e.target as HTMLImageElement; target.style.display = 'none'; const parent = target.parentElement; @@ -131,8 +141,8 @@ export default function ContentImageCell({ image, maxPromptLength = 100 }: Conte )} ) : ( -
-

No image available

+
+

No image available

)}