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

+ 4 - 2
lib/single-file/single-file-core.js

@@ -1011,7 +1011,8 @@ 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)) {
-							let importedStylesheetContent = await Download.getContent(resourceURL, { asDataURI: false, maxResourceSize: options.maxResourceSize, maxResourceSizeEnabled: options.maxResourceSizeEnabled });
+							const downloadOptions = { asDataURI: false, maxResourceSize: options.maxResourceSize, maxResourceSizeEnabled: options.maxResourceSizeEnabled };
+							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)) {
 								importedStylesheetContent = await DomProcessorHelper.resolveImportURLs(importedStylesheetContent, resourceURL, options);
 								importedStylesheetContent = await DomProcessorHelper.resolveImportURLs(importedStylesheetContent, resourceURL, options);
@@ -1051,7 +1052,8 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 		static async resolveLinkStylesheetURLs(resourceURL, baseURI, options) {
 		static async resolveLinkStylesheetURLs(resourceURL, baseURI, options) {
 			resourceURL = DomUtil.normalizeURL(resourceURL);
 			resourceURL = DomUtil.normalizeURL(resourceURL);
 			if (resourceURL && resourceURL != baseURI && resourceURL != ABOUT_BLANK_URI) {
 			if (resourceURL && resourceURL != baseURI && resourceURL != ABOUT_BLANK_URI) {
-				let stylesheetContent = await Download.getContent(resourceURL, { asDataURI: false, maxResourceSize: options.maxResourceSize, maxResourceSizeEnabled: options.maxResourceSizeEnabled, charSet: options.charSet });
+				const downloadOptions = { asDataURI: false, maxResourceSize: options.maxResourceSize, maxResourceSizeEnabled: options.maxResourceSizeEnabled, charSet: options.charSet };
+				let stylesheetContent = await Download.getContent(resourceURL, downloadOptions);
 				stylesheetContent = await DomProcessorHelper.resolveImportURLs(stylesheetContent, resourceURL, options);
 				stylesheetContent = await DomProcessorHelper.resolveImportURLs(stylesheetContent, resourceURL, options);
 				return stylesheetContent;
 				return stylesheetContent;
 			}
 			}