E-Mail Anhang-Download über API-Client laden

KI-AGENT: Der Attachment-Download nutzt jetzt den zentralen API-Client mit apiBase, damit keine Frontend-HTML-Seite mehr als PDF gespeichert wird.
This commit is contained in:
2026-05-23 20:54:29 +02:00
parent 4fd2eb9c40
commit d45cefbc20

View File

@@ -456,12 +456,8 @@ async function moveSelectedMessage() {
async function downloadAttachment(attachment: NonNullable<EmailMessage["attachments"]>[number]) {
actionLoading.value = `attachment-${attachment.id}`
try {
const response = await $fetch.raw(`/api/email/attachments/${attachment.id}/download`, {
const response = await $api.raw(`/api/email/attachments/${attachment.id}/download`, {
responseType: "arrayBuffer",
credentials: "include",
headers: {
...(useCookie("token").value ? { Authorization: `Bearer ${useCookie("token").value}` } : {}),
},
})
const contentType = response.headers.get("content-type") || attachment.contentType || "application/octet-stream"
const blob = new Blob([response._data as ArrayBuffer], { type: contentType })