Node.js based forum software built for the modern web
Merge branch 'master' into develop
Barış Soner Uşaklıdcdda2a8c8e8
diff --cc src/controllers/admin/uploads.jsindex 74d1370de0,0f70380695..c8e8075456--- a/src/controllers/admin/uploads.js+++ b/src/controllers/admin/uploads.js@@@ -168,43 -161,8 +163,8 @@@ uploadsController.uploadCategoryPicturawait uploadImage(filename, 'category', uploadedFile, req, res, next);};- async function sanitizeSvg(filePath) {- const dirty = await fs.promises.readFile(filePath, 'utf8');- const clean = sanitizeHtml(dirty, {- allowedTags: [- 'svg', 'g', 'defs', 'linearGradient', 'radialGradient', 'stop',- 'circle', 'ellipse', 'polygon', 'polyline', 'path', 'rect',- 'line', 'text', 'tspan', 'use', 'symbol', 'clipPath', 'mask', 'pattern',- 'filter', 'feGaussianBlur', 'feOffset', 'feBlend', 'feColorMatrix', 'feMerge', 'feMergeNode',- ],- allowedAttributes: {- '*': [- // Geometry- 'x', 'y', 'x1', 'x2', 'y1', 'y2', 'cx', 'cy', 'r', 'rx', 'ry',- 'width', 'height', 'd', 'points', 'viewBox', 'transform',-- // Presentation- 'fill', 'stroke', 'stroke-width', 'opacity',- 'stop-color', 'stop-opacity', 'offset', 'style', 'class',-- // Text- 'text-anchor', 'font-size', 'font-family',-- // Misc- 'id', 'clip-path', 'mask', 'filter', 'gradientUnits', 'gradientTransform',- 'xmlns', 'preserveAspectRatio',- ],- },- parser: {- lowerCaseTags: false,- lowerCaseAttributeNames: false,- },- });- await fs.promises.writeFile(filePath, clean);- }-uploadsController.uploadFavicon = async function (req, res, next) {- const uploadedFile = req.files.files[0];+ const uploadedFile = req.files[0];const allowedTypes = ['image/x-icon', 'image/vnd.microsoft.icon'];await validateUpload(uploadedFile, allowedTypes);@@@ -296,12 -254,8 +256,8 @@@ uploadsController.uploadOgImage = asyn};async function upload(name, req, res, next) {- const uploadedFile = req.files.files[0];+ const uploadedFile = req.files[0];- if (uploadedFile.path.endsWith('.svg')) {- await sanitizeSvg(uploadedFile.path);- }-await validateUpload(uploadedFile, allowedImageTypes);const filename = name + path.extname(uploadedFile.name);await uploadImage(filename, 'system', uploadedFile, req, res, next);