mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-16 05:20:24 +01:00
fix: #13779, svg uploads
if tmp file doesn't have extension stripEXIF was called for gifs/svgs
This commit is contained in:
@@ -61,7 +61,7 @@ async function uploadAsImage(req, uploadedFile) {
|
||||
throw new Error('[[error:no-privileges]]');
|
||||
}
|
||||
await image.checkDimensions(uploadedFile.path);
|
||||
await image.stripEXIF(uploadedFile.path);
|
||||
await image.stripEXIF({ path: uploadedFile.path, type: uploadedFile.type });
|
||||
|
||||
if (plugins.hooks.hasListeners('filter:uploadImage')) {
|
||||
return await plugins.hooks.fire('filter:uploadImage', {
|
||||
|
||||
@@ -102,14 +102,15 @@ image.size = async function (path) {
|
||||
return imageData ? { width: imageData.width, height: imageData.height } : undefined;
|
||||
};
|
||||
|
||||
image.stripEXIF = async function (path) {
|
||||
if (!meta.config.stripEXIFData || path.endsWith('.gif') || path.endsWith('.svg')) {
|
||||
image.stripEXIF = async function ({ path, type }) {
|
||||
if (!meta.config.stripEXIFData || type === 'image/gif' || type === 'image/svg+xml') {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (plugins.hooks.hasListeners('filter:image.stripEXIF')) {
|
||||
await plugins.hooks.fire('filter:image.stripEXIF', {
|
||||
path: path,
|
||||
type: type,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user