Skip to content

Commit

Permalink
fix parsing of svg images
Browse files Browse the repository at this point in the history
  • Loading branch information
gildas-lormeau committed Sep 2, 2021
1 parent c019eff commit 8db6023
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/single-file/single-file-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1911,8 +1911,8 @@ class ProcessorHelper {
if (testValidURL(resourceURL)) {
let svgDoc;
if (!originalResourceURL.startsWith(baseURI + "#")) {
const content = await batchRequest.addURL(resourceURL);
svgDoc = util.parseSVGContent(content);
const response = await batchRequest.addURL(resourceURL);
svgDoc = util.parseSVGContent(response.content);
} else {
svgDoc = doc;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/single-file/single-file-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ function getInstance(utilOptions) {
const doc = (new DOMParser()).parseFromString(content, "image/svg+xml");
if (doc.querySelector("parsererror")) {
return (new DOMParser()).parseFromString(content, "text/html");
} else {
return doc;
}
},
async digest(algo, text) {
Expand Down

0 comments on commit 8db6023

Please sign in to comment.