From 94f2c20d3515544b61a4800f8f4fef41c2fdbc38 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 {