mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +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 config = require('../../../../shared/config');
|
||||||
const tpl = require('@tryghost/tpl');
|
const tpl = require('@tryghost/tpl');
|
||||||
const logging = require('@tryghost/logging');
|
const logging = require('@tryghost/logging');
|
||||||
const {JSDOM} = require('jsdom');
|
|
||||||
|
|
||||||
const messages = {
|
const messages = {
|
||||||
db: {
|
db: {
|
||||||
@ -160,6 +159,8 @@ const checkFileIsValid = (fileData, types, extensions) => {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const isSvgSafe = (filepath) => {
|
const isSvgSafe = (filepath) => {
|
||||||
|
const {JSDOM} = require('jsdom');
|
||||||
|
|
||||||
const fileContent = fs.readFileSync(filepath, 'utf8');
|
const fileContent = fs.readFileSync(filepath, 'utf8');
|
||||||
const document = new JSDOM(fileContent).window.document;
|
const document = new JSDOM(fileContent).window.document;
|
||||||
document.body.innerHTML = fileContent;
|
document.body.innerHTML = fileContent;
|
||||||
|
Loading…
Reference in New Issue
Block a user