1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-13 14:18:31 +09:00

APNGでもMIME typeはimage/pngにするように (#5100)

* APNGでもMIME typeはimage/pngにするように

* Revert "APNGでもMIME typeはimage/pngにするように"

This reverts commit e579eb2bf4.

* APNGはファイル送信時のみimage/pngにするように
This commit is contained in:
MeiMei 2019-07-05 17:44:23 +09:00 committed by syuilo
parent 6a53ccf814
commit 26f2ae093b
3 changed files with 4 additions and 2 deletions

View File

@ -42,7 +42,7 @@ export default async function(ctx: Koa.BaseContext) {
ctx.set('Content-Disposition', contentDisposition('inline', `${rename(file.name, { suffix: '-thumb', extname: '.jpeg' })}`)); ctx.set('Content-Disposition', contentDisposition('inline', `${rename(file.name, { suffix: '-thumb', extname: '.jpeg' })}`));
ctx.body = InternalStorage.read(key); ctx.body = InternalStorage.read(key);
} else if (isWebpublic) { } else if (isWebpublic) {
ctx.set('Content-Type', file.type); ctx.set('Content-Type', file.type === 'image/apng' ? 'image/png' : file.type);
ctx.set('Content-Disposition', contentDisposition('inline', `${rename(file.name, { suffix: '-web' })}`)); ctx.set('Content-Disposition', contentDisposition('inline', `${rename(file.name, { suffix: '-web' })}`));
ctx.body = InternalStorage.read(key); ctx.body = InternalStorage.read(key);
} else { } else {

View File

@ -207,6 +207,8 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
* Upload to ObjectStorage * Upload to ObjectStorage
*/ */
async function upload(key: string, stream: fs.ReadStream | Buffer, type: string, filename?: string) { async function upload(key: string, stream: fs.ReadStream | Buffer, type: string, filename?: string) {
if (type === 'image/apng') type = 'image/png';
const meta = await fetchMeta(); const meta = await fetchMeta();
const minio = new Minio.Client({ const minio = new Minio.Client({

View File

@ -97,6 +97,6 @@ export async function convertToApng(path: string): Promise<IImage> {
return { return {
data, data,
ext: 'apng', ext: 'apng',
type: 'image/vnd.mozilla.apng' type: 'image/apng'
}; };
} }