Gildas 7 лет назад
Родитель
Сommit
f3a5e47ab3
2 измененных файлов с 2 добавлено и 2 удалено
  1. 1 1
      lib/single-file/single-file-browser.js
  2. 1 1
      lib/single-file/single-file-core.js

+ 1 - 1
lib/single-file/single-file-browser.js

@@ -103,7 +103,7 @@ this.SingleFile = this.SingleFile || (() => {
 					return "data:base64,";
 					return "data:base64,";
 				}
 				}
 			} else {
 			} else {
-				if (!contentType.startsWith(PREFIX_CONTENT_TYPE_TEXT)) {
+				if (options.validateTextContentType && contentType && !contentType.startsWith(PREFIX_CONTENT_TYPE_TEXT)) {
 					return "";
 					return "";
 				}
 				}
 				if (!charSet) {
 				if (!charSet) {

+ 1 - 1
lib/single-file/single-file-core.js

@@ -1006,7 +1006,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 					if (!DomUtil.testIgnoredPath(resourceURL) && DomUtil.testValidPath(resourceURL, baseURI, options.url)) {
 					if (!DomUtil.testIgnoredPath(resourceURL) && DomUtil.testValidPath(resourceURL, baseURI, options.url)) {
 						resourceURL = new URL(match.resourceURL, baseURI).href;
 						resourceURL = new URL(match.resourceURL, baseURI).href;
 						if (DomUtil.testValidURL(resourceURL, baseURI, options.url)) {
 						if (DomUtil.testValidURL(resourceURL, baseURI, options.url)) {
-							const downloadOptions = { asDataURI: false, maxResourceSize: options.maxResourceSize, maxResourceSizeEnabled: options.maxResourceSizeEnabled };
+							const downloadOptions = { asDataURI: false, maxResourceSize: options.maxResourceSize, maxResourceSizeEnabled: options.maxResourceSizeEnabled, validateTextContentType: true };
 							let importedStylesheetContent = await Download.getContent(resourceURL, downloadOptions);
 							let importedStylesheetContent = await Download.getContent(resourceURL, downloadOptions);
 							importedStylesheetContent = DomUtil.wrapMediaQuery(importedStylesheetContent, match.media);
 							importedStylesheetContent = DomUtil.wrapMediaQuery(importedStylesheetContent, match.media);
 							if (stylesheetContent.includes(cssImport)) {
 							if (stylesheetContent.includes(cssImport)) {