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:
parent
8547b9b66e
commit
ec2ec4014c
|
@ -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 }
|
return { contentDisposition, contentType }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue