This commit is contained in:
syuilo
2021-12-29 17:21:08 +09:00
parent 3e00ce0d88
commit aedbab17cc
4 changed files with 4 additions and 54 deletions

View File

@@ -6,7 +6,6 @@ import { createTemp } from '@/misc/create-temp';
import { downloadUrl } from '@/misc/download-url';
import { detectType } from '@/misc/get-file-info';
import { StatusError } from '@/misc/fetch';
import { FILE_TYPE_BROWSERSAFE } from '@/const';
export async function proxyMedia(ctx: Koa.Context) {
const url = 'url' in ctx.query ? ctx.query.url : 'https://' + ctx.params.url;
@@ -19,7 +18,7 @@ export async function proxyMedia(ctx: Koa.Context) {
const { mime, ext } = await detectType(path);
if (!FILE_TYPE_BROWSERSAFE.includes(mime)) throw 403;
if (!mime.startsWith('image/')) throw 403;
let image: IImage;