Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

⬇️ fix: Image Download Browser Compatibility (#7950)

Danny Avila10c0d7d47408
diff --git a/client/src/components/Chat/Messages/Content/Image.tsx b/client/src/components/Chat/Messages/Content/Image.tsx
index 85c3fdb3f2..ba4f65671a 100644
--- a/client/src/components/Chat/Messages/Content/Image.tsx
+++ b/client/src/components/Chat/Messages/Content/Image.tsx
@@ -46,13 +46,33 @@ const Image = ({
[placeholderDimensions, height, width],
);
- const downloadImage = () => {
- const link = document.createElement('a');
- link.href = imagePath;
- link.download = altText;
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
+ const downloadImage = async () => {
+ try {
+ const response = await fetch(imagePath);
+ if (!response.ok) {
+ throw new Error(`Failed to fetch image: ${response.status}`);
+ }
+
+ const blob = await response.blob();
+ const url = window.URL.createObjectURL(blob);
+
+ const link = document.createElement('a');
+ link.href = url;
+ link.download = altText || 'image.png';
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+
+ window.URL.revokeObjectURL(url);
+ } catch (error) {
+ console.error('Download failed:', error);
+ const link = document.createElement('a');
+ link.href = imagePath;
+ link.download = altText || 'image.png';
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ }
};
return (
diff --git a/client/src/components/Chat/Messages/MessageAudio.tsx b/client/src/components/Chat/Messages/MessageAudio.tsx
index 29805e7afb..eb4c52a407 100644
--- a/client/src/components/Chat/Messages/MessageAudio.tsx
+++ b/client/src/components/Chat/Messages/MessageAudio.tsx
@@ -14,6 +14,9 @@ function MessageAudio(props: TMessageAudio) {
};
const SelectedTTS = TTSComponents[engineTTS];
+ if (!SelectedTTS) {
+ return null;
+ }
return <SelectedTTS {...props} />;
}