|
|
@@ -272,6 +272,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
// ------------
|
|
|
const ESCAPED_FRAGMENT = "_escaped_fragment_=";
|
|
|
const EMPTY_DATA_URI = "data:base64,";
|
|
|
+ const EMPTY_IMAGE = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
|
|
|
|
|
|
class DOMProcessor {
|
|
|
constructor(options, batchRequest) {
|
|
|
@@ -842,6 +843,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
const PREFIX_DATA_URI_AUDIO = "data:audio/";
|
|
|
const PREFIX_DATA_URI_VIDEO = "data:video/";
|
|
|
const PREFIX_DATA_URI_IMAGE_SVG = "data:image/svg+xml";
|
|
|
+ const PREFIX_DATA_URI_NO_MIMETYPE = "data:;";
|
|
|
|
|
|
class DomProcessorHelper {
|
|
|
static async getFilename(options, content) {
|
|
|
@@ -1034,13 +1036,13 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
if (resourceURL && resourceURL != baseURI && DomUtil.testValidPath(resourceURL)) {
|
|
|
try {
|
|
|
const dataURI = await batchRequest.addURL(new URL(resourceURL, baseURI).href);
|
|
|
- if (dataURI.startsWith(prefixDataURI)) {
|
|
|
+ if (dataURI.startsWith(prefixDataURI) || dataURI.startsWith(PREFIX_DATA_URI_NO_MIMETYPE)) {
|
|
|
resourceElement.setAttribute(attributeName, dataURI);
|
|
|
} else {
|
|
|
- resourceElement.setAttribute(attributeName, EMPTY_DATA_URI);
|
|
|
+ resourceElement.setAttribute(attributeName, EMPTY_IMAGE);
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- resourceElement.setAttribute(attributeName, EMPTY_DATA_URI);
|
|
|
+ resourceElement.setAttribute(attributeName, EMPTY_IMAGE);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1073,7 +1075,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
resourceElement.setAttribute(attributeName, "data:image/svg+xml," + content);
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- resourceElement.setAttribute(attributeName, EMPTY_DATA_URI);
|
|
|
+ resourceElement.setAttribute(attributeName, EMPTY_IMAGE);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1088,12 +1090,12 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
if (resourceURL && resourceURL != baseURI && DomUtil.testValidPath(resourceURL)) {
|
|
|
try {
|
|
|
let dataURI = await batchRequest.addURL(new URL(resourceURL, baseURI).href);
|
|
|
- if (!dataURI.startsWith(prefixDataURI)) {
|
|
|
- resourceElement.setAttribute(attributeName, EMPTY_DATA_URI);
|
|
|
+ if (!dataURI.startsWith(prefixDataURI) && !dataURI.startsWith(PREFIX_DATA_URI_NO_MIMETYPE)) {
|
|
|
+ resourceElement.setAttribute(attributeName, EMPTY_IMAGE);
|
|
|
}
|
|
|
return dataURI + (srcsetValue.w ? " " + srcsetValue.w + "w" : srcsetValue.d ? " " + srcsetValue.d + "x" : "");
|
|
|
} catch (error) {
|
|
|
- resourceElement.setAttribute(attributeName, EMPTY_DATA_URI);
|
|
|
+ resourceElement.setAttribute(attributeName, EMPTY_IMAGE);
|
|
|
}
|
|
|
}
|
|
|
}));
|