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:
@@ -456,12 +456,8 @@ async function moveSelectedMessage() {
|
|||||||
async function downloadAttachment(attachment: NonNullable<EmailMessage["attachments"]>[number]) {
|
async function downloadAttachment(attachment: NonNullable<EmailMessage["attachments"]>[number]) {
|
||||||
actionLoading.value = `attachment-${attachment.id}`
|
actionLoading.value = `attachment-${attachment.id}`
|
||||||
try {
|
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",
|
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 contentType = response.headers.get("content-type") || attachment.contentType || "application/octet-stream"
|
||||||
const blob = new Blob([response._data as ArrayBuffer], { type: contentType })
|
const blob = new Blob([response._data as ArrayBuffer], { type: contentType })
|
||||||
|
|||||||
Reference in New Issue
Block a user