fix Content-Disposition (#4573)
This commit is contained in:
parent
9471ddb136
commit
a7de3df349
1 changed files with 4 additions and 4 deletions
|
@ -64,12 +64,12 @@ export default async function(ctx: Koa.BaseContext) {
|
||||||
|
|
||||||
if (thumb != null) {
|
if (thumb != null) {
|
||||||
ctx.set('Content-Type', 'image/jpeg');
|
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();
|
const bucket = await getDriveFileThumbnailBucket();
|
||||||
ctx.body = bucket.openDownloadStream(thumb._id);
|
ctx.body = bucket.openDownloadStream(thumb._id);
|
||||||
} else {
|
} else {
|
||||||
if (file.contentType.startsWith('image/')) {
|
if (file.contentType.startsWith('image/')) {
|
||||||
ctx.set('Content-Disposition', contentDisposition('inline', `${file.filename}"`));
|
ctx.set('Content-Disposition', contentDisposition('inline', `${file.filename}`));
|
||||||
await sendRaw();
|
await sendRaw();
|
||||||
} else {
|
} else {
|
||||||
ctx.status = 404;
|
ctx.status = 404;
|
||||||
|
@ -83,12 +83,12 @@ export default async function(ctx: Koa.BaseContext) {
|
||||||
|
|
||||||
if (web != null) {
|
if (web != null) {
|
||||||
ctx.set('Content-Type', file.contentType);
|
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();
|
const bucket = await getDriveFileWebpublicBucket();
|
||||||
ctx.body = bucket.openDownloadStream(web._id);
|
ctx.body = bucket.openDownloadStream(web._id);
|
||||||
} else {
|
} else {
|
||||||
ctx.set('Content-Disposition', contentDisposition('inline', `${file.filename}"`));
|
ctx.set('Content-Disposition', contentDisposition('inline', `${file.filename}`));
|
||||||
await sendRaw();
|
await sendRaw();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue