fix: sanitize SVG uploads
This commit is contained in:
6 files changed
+79
-25
No files matched your search
@@ -99,6 +99,16 @@ module.exports = class Asset extends Model {
|
||||
folderId: opts.folderId
|
||||
}
|
||||
|
||||
// Sanitize SVG contents
|
||||
if (WIKI.config.uploads.scanSVG && opts.mimetype === 'image/svg+xml') {
|
||||
const svgSanitizeJob = await WIKI.scheduler.registerJob({
|
||||
name: 'sanitize-svg',
|
||||
immediate: true,
|
||||
worker: true
|
||||
}, opts.path)
|
||||
await svgSanitizeJob.finished
|
||||
}
|
||||
|
||||
// Save asset data
|
||||
try {
|
||||
const fileBuffer = await fs.readFile(opts.path)
|
||||
|
||||
Reference in new issue
Block a user