force template html as html code, not an url or file path

ensure that external resources are not loaded by jsdom
This commit is contained in:
Andris Reinman 2017-03-19 14:06:34 +02:00
parent 9d5fb816c9
commit 0879fa412a

View file

@ -199,8 +199,13 @@ function prepareHtml(html, callback) {
if (!(html || '').toString().trim()) { if (!(html || '').toString().trim()) {
return callback(null, false); return callback(null, false);
} }
jsdom.env(false, false, {
jsdom.env(html, (err, win) => { html,
features: {
FetchExternalResources: false, // disables resource loading over HTTP / filesystem
ProcessExternalResources: false // do not execute JS within script blocks
}
}, (err, win) => {
if (err) { if (err) {
return callback(err); return callback(err);
} }