From 36fb277cf2c1d01253ec50449f05579b0d09c759 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Tue, 5 Mar 2019 07:56:23 +0900 Subject: [PATCH] Fix #4413 (#4417) --- src/server/proxy/proxy-media.ts | 6 +++++- src/services/drive/add-file.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/server/proxy/proxy-media.ts b/src/server/proxy/proxy-media.ts index 8560c0e1e..379dc1f84 100644 --- a/src/server/proxy/proxy-media.ts +++ b/src/server/proxy/proxy-media.ts @@ -101,7 +101,11 @@ async function detectMine(path: string) { readable.destroy(); const type = fileType(buffer); if (type) { - res([type.mime, type.ext]); + if (type.mime == 'application/xml' && checkSvg(path)) { + res(['image/svg+xml', 'svg']); + } else { + res([type.mime, type.ext]); + } } else if (checkSvg(path)) { res(['image/svg+xml', 'svg']); } else { diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index 3fa375e8d..5b082a4fa 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -310,7 +310,11 @@ export default async function( readable.destroy(); const type = fileType(buffer); if (type) { - res([type.mime, type.ext]); + if (type.mime == 'application/xml' && checkSvg(path)) { + res(['image/svg+xml', 'svg']); + } else { + res([type.mime, type.ext]); + } } else if (checkSvg(path)) { res(['image/svg+xml', 'svg']); } else {