Skip to content

Commit

Permalink
force template html as html code, not an url or file path
Browse files Browse the repository at this point in the history
ensure that external resources are not loaded by jsdom
  • Loading branch information
andris9 committed Mar 19, 2017
1 parent 9d5fb81 commit 0879fa4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,13 @@ function prepareHtml(html, callback) {
if (!(html || '').toString().trim()) {
return callback(null, false);
}

jsdom.env(html, (err, win) => {
jsdom.env(false, false, {
html,
features: {
FetchExternalResources: false, // disables resource loading over HTTP / filesystem
ProcessExternalResources: false // do not execute JS within script blocks
}
}, (err, win) => {
if (err) {
return callback(err);
}
Expand Down

0 comments on commit 0879fa4

Please sign in to comment.