mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-17 22:10:23 +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]]');
|
throw new Error('[[error:no-privileges]]');
|
||||||
}
|
}
|
||||||
await image.checkDimensions(uploadedFile.path);
|
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')) {
|
if (plugins.hooks.hasListeners('filter:uploadImage')) {
|
||||||
return await plugins.hooks.fire('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;
|
return imageData ? { width: imageData.width, height: imageData.height } : undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
image.stripEXIF = async function (path) {
|
image.stripEXIF = async function ({ path, type }) {
|
||||||
if (!meta.config.stripEXIFData || path.endsWith('.gif') || path.endsWith('.svg')) {
|
if (!meta.config.stripEXIFData || type === 'image/gif' || type === 'image/svg+xml') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (plugins.hooks.hasListeners('filter:image.stripEXIF')) {
|
if (plugins.hooks.hasListeners('filter:image.stripEXIF')) {
|
||||||
await plugins.hooks.fire('filter:image.stripEXIF', {
|
await plugins.hooks.fire('filter:image.stripEXIF', {
|
||||||
path: path,
|
path: path,
|
||||||
|
type: type,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user