image以外はproxyしないように (#5051)

This commit is contained in:
MeiMei 2019-06-14 12:14:23 +09:00 committed by mei23
parent e274c73177
commit 2c2de1282a
No known key found for this signature in database
GPG key ID: DD8628500D3E4B23

View file

@ -17,6 +17,8 @@ export async function proxyMedia(ctx: Koa.BaseContext) {
const [type, ext] = await detectMine(path); const [type, ext] = await detectMine(path);
if (!type.startsWith('image/')) throw 403;
let image: IImage; let image: IImage;
if ('static' in ctx.query && ['image/png', 'image/gif'].includes(type)) { if ('static' in ctx.query && ['image/png', 'image/gif'].includes(type)) {