diff --git a/src/controllers/uploads.js b/src/controllers/uploads.js index 266c623548..bbaeb5ab31 100644 --- a/src/controllers/uploads.js +++ b/src/controllers/uploads.js @@ -69,8 +69,9 @@ async function uploadAsImage(req, uploadedFile) { await image.isFileTypeAllowed(uploadedFile.path); let fileObj = await uploadsController.uploadFile(req.uid, uploadedFile); - - if (meta.config.resizeImageWidth === 0 || meta.config.resizeImageWidthThreshold === 0) { + // sharp can't save svgs skip resize for them + const isSVG = uploadedFile.type === 'image/svg+xml'; + if (isSVG || meta.config.resizeImageWidth === 0 || meta.config.resizeImageWidthThreshold === 0) { return fileObj; } diff --git a/src/image.js b/src/image.js index ec73a0bc08..bafae61f83 100644 --- a/src/image.js +++ b/src/image.js @@ -86,7 +86,7 @@ image.size = async function (path) { }; image.stripEXIF = async function (path) { - if (!meta.config.stripEXIFData || path.endsWith('.gif')) { + if (!meta.config.stripEXIFData || path.endsWith('.gif') || path.endsWith('.svg')) { return; } try {