1
0
Fork 0
mirror of synced 2024-08-05 13:21:26 +12:00

Fixing an issue with images and REST queries, these traditionally have only come back as binary data to Budibase, but this isn't very useful, its very difficult to convert these into something that can be used. Instead we will now download images into temporary attachments as we do for other types with a real content-disposition.

This commit is contained in:
mike12345567 2024-05-17 14:01:43 +01:00
parent 8547b9b66e
commit ec2ec4014c

View file

@ -23,6 +23,15 @@ export function getAttachmentHeaders(headers: Headers) {
}
}
}
// for images which don't supply a content disposition, make one up, as binary
// data for images in REST responses isn't really useful, we should always download them
else if (contentType.startsWith("image/")) {
const format = contentType.split("/")[1]
return {
contentDisposition: `attachment; filename="image.${format}"`,
contentType,
}
}
return { contentDisposition, contentType }
}