+
Generate EOI
diff --git a/components/EmailDetailsDialog.vue b/components/EmailDetailsDialog.vue
index deef7cc..e8d433d 100644
--- a/components/EmailDetailsDialog.vue
+++ b/components/EmailDetailsDialog.vue
@@ -62,8 +62,12 @@
variant="tonal"
prepend-icon="mdi-paperclip"
class="mr-2 mb-2"
+ :href="getAttachmentUrl(attachment)"
+ :download="getAttachmentName(attachment)"
+ component="a"
+ target="_blank"
>
- {{ attachment.name || attachment }}
+ {{ getAttachmentName(attachment) }}
@@ -128,6 +132,22 @@ const formatEmailContent = (content: string) => {
.map(line => line.trim() ? `
${line}
` : '
')
.join('');
};
+
+const getAttachmentName = (attachment: any) => {
+ if (typeof attachment === 'string') return attachment;
+ return attachment.name || attachment.filename || 'attachment';
+};
+
+const getAttachmentUrl = (attachment: any) => {
+ // If attachment has a path and bucket, construct the download URL
+ if (attachment.path && attachment.bucket) {
+ return `/api/files/proxy-download?path=${encodeURIComponent(attachment.path)}&bucket=${attachment.bucket}`;
+ }
+ // If it's just a URL, return it
+ if (attachment.url) return attachment.url;
+ // Otherwise return a placeholder
+ return '#';
+};