Prechádzať zdrojové kódy

fixed regression when importing URLs

Gildas 7 rokov pred
rodič
commit
04b6bbe5f6
1 zmenil súbory, kde vykonal 5 pridanie a 5 odobranie
  1. 5 5
      lib/single-file/single-file-core.js

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

@@ -961,14 +961,14 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			await Promise.all(imports.map(async cssImport => {
 				const match = DomUtil.matchImport(cssImport);
 				if (match) {
-					const resourceURL = DomUtil.normalizeURL(match.resourceURL);
+					let resourceURL = DomUtil.normalizeURL(match.resourceURL);
 					if (!DomUtil.testIgnoredPath(resourceURL) && DomUtil.testValidPath(resourceURL)) {
-						const styleSheetUrl = new URL(match.resourceURL, baseURI).href;
-						if (DomUtil.testValidURL(resourceURL)) {
-							let importedStylesheetContent = await Download.getContent(styleSheetUrl, { asDataURI: false, maxResourceSize: options.maxResourceSize, maxResourceSizeEnabled: options.maxResourceSizeEnabled });
+						resourceURL = new URL(match.resourceURL, baseURI).href;
+						if (DomUtil.testValidURL(resourceURL, baseURI)) {
+							let importedStylesheetContent = await Download.getContent(resourceURL, { asDataURI: false, maxResourceSize: options.maxResourceSize, maxResourceSizeEnabled: options.maxResourceSizeEnabled });
 							importedStylesheetContent = DomUtil.wrapMediaQuery(importedStylesheetContent, match.media);
 							if (stylesheetContent.includes(cssImport)) {
-								importedStylesheetContent = await DomProcessorHelper.resolveImportURLs(importedStylesheetContent, styleSheetUrl, options);
+								importedStylesheetContent = await DomProcessorHelper.resolveImportURLs(importedStylesheetContent, resourceURL, options);
 								stylesheetContent = stylesheetContent.replace(DomUtil.getRegExp(cssImport), importedStylesheetContent);
 							}
 						}