Fix incorrect content type header when serving attachments
This commit is contained in:
parent
8428bebc13
commit
be805d05cf
|
@ -163,15 +163,14 @@ exports.serveApp = async function(ctx) {
|
||||||
|
|
||||||
exports.serveAttachment = async function(ctx) {
|
exports.serveAttachment = async function(ctx) {
|
||||||
const appId = ctx.user.appId
|
const appId = ctx.user.appId
|
||||||
|
|
||||||
const attachmentsPath = resolve(budibaseAppsDir(), appId, "attachments")
|
const attachmentsPath = resolve(budibaseAppsDir(), appId, "attachments")
|
||||||
|
|
||||||
// Serve from CloudFront
|
// Serve from CloudFront
|
||||||
if (process.env.CLOUD) {
|
if (process.env.CLOUD) {
|
||||||
const S3_URL = `https://cdn.app.budi.live/assets/${appId}/attachments/${ctx.file}`
|
const S3_URL = `https://cdn.app.budi.live/assets/${appId}/attachments/${ctx.file}`
|
||||||
|
|
||||||
const response = await fetch(S3_URL)
|
const response = await fetch(S3_URL)
|
||||||
const body = await response.text()
|
const body = await response.text()
|
||||||
|
ctx.set("Content-Type", response.headers.get("Content-Type"))
|
||||||
ctx.body = body
|
ctx.body = body
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue