mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #9074, fix svg uploads
This commit is contained in:
@@ -69,8 +69,9 @@ async function uploadAsImage(req, uploadedFile) {
|
|||||||
await image.isFileTypeAllowed(uploadedFile.path);
|
await image.isFileTypeAllowed(uploadedFile.path);
|
||||||
|
|
||||||
let fileObj = await uploadsController.uploadFile(req.uid, uploadedFile);
|
let fileObj = await uploadsController.uploadFile(req.uid, uploadedFile);
|
||||||
|
// sharp can't save svgs skip resize for them
|
||||||
if (meta.config.resizeImageWidth === 0 || meta.config.resizeImageWidthThreshold === 0) {
|
const isSVG = uploadedFile.type === 'image/svg+xml';
|
||||||
|
if (isSVG || meta.config.resizeImageWidth === 0 || meta.config.resizeImageWidthThreshold === 0) {
|
||||||
return fileObj;
|
return fileObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ image.size = async function (path) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
image.stripEXIF = 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;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user