Skip to content
Snippets Groups Projects
Commit 818b71ab authored by MeiMei's avatar MeiMei Committed by syuilo
Browse files

fix Content-Disposition (#4573)

parent 25575e85
No related branches found
No related tags found
No related merge requests found
......@@ -64,12 +64,12 @@ export default async function(ctx: Koa.BaseContext) {
if (thumb != null) {
ctx.set('Content-Type', 'image/jpeg');
ctx.set('Content-Disposition', contentDisposition('inline', `${rename(file.filename, { suffix: '-thumb', extname: '.jpeg' })}"`));
ctx.set('Content-Disposition', contentDisposition('inline', `${rename(file.filename, { suffix: '-thumb', extname: '.jpeg' })}`));
const bucket = await getDriveFileThumbnailBucket();
ctx.body = bucket.openDownloadStream(thumb._id);
} else {
if (file.contentType.startsWith('image/')) {
ctx.set('Content-Disposition', contentDisposition('inline', `${file.filename}"`));
ctx.set('Content-Disposition', contentDisposition('inline', `${file.filename}`));
await sendRaw();
} else {
ctx.status = 404;
......@@ -83,12 +83,12 @@ export default async function(ctx: Koa.BaseContext) {
if (web != null) {
ctx.set('Content-Type', file.contentType);
ctx.set('Content-Disposition', contentDisposition('inline', `${rename(file.filename, { suffix: '-web' })}"`));
ctx.set('Content-Disposition', contentDisposition('inline', `${rename(file.filename, { suffix: '-web' })}`));
const bucket = await getDriveFileWebpublicBucket();
ctx.body = bucket.openDownloadStream(web._id);
} else {
ctx.set('Content-Disposition', contentDisposition('inline', `${file.filename}"`));
ctx.set('Content-Disposition', contentDisposition('inline', `${file.filename}`));
await sendRaw();
}
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment