Skip to content

Commit

Permalink
fix: validate svg file extension in addition to client mime type
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Dec 25, 2021
1 parent e79e591 commit 57b56d3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/models/assets.js
Expand Up @@ -100,7 +100,13 @@ module.exports = class Asset extends Model {
}

// Sanitize SVG contents
if (WIKI.config.uploads.scanSVG && opts.mimetype === 'image/svg+xml') {
if (
WIKI.config.uploads.scanSVG &&
(
opts.mimetype.toLowerCase().startsWith('image/svg') ||
opts.ext.toLowerCase() === 'svg'
)
) {
const svgSanitizeJob = await WIKI.scheduler.registerJob({
name: 'sanitize-svg',
immediate: true,
Expand Down

0 comments on commit 57b56d3

Please sign in to comment.