mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 07:09:48 +03:00
Lazyloaded jsdom dependency
- we can move this later into the code to prevent it from being eagerly loaded and taking up CPU time and memory
This commit is contained in:
parent
1c9e55cf7b
commit
8fd32f012b
@ -6,7 +6,6 @@ const errors = require('@tryghost/errors');
|
||||
const config = require('../../../../shared/config');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const logging = require('@tryghost/logging');
|
||||
const {JSDOM} = require('jsdom');
|
||||
|
||||
const messages = {
|
||||
db: {
|
||||
@ -160,6 +159,8 @@ const checkFileIsValid = (fileData, types, extensions) => {
|
||||
*
|
||||
*/
|
||||
const isSvgSafe = (filepath) => {
|
||||
const {JSDOM} = require('jsdom');
|
||||
|
||||
const fileContent = fs.readFileSync(filepath, 'utf8');
|
||||
const document = new JSDOM(fileContent).window.document;
|
||||
document.body.innerHTML = fileContent;
|
||||
|
Loading…
Reference in New Issue
Block a user