fix data url regexp

This commit is contained in:
Yanzhen Yu
2019-08-31 16:13:02 +08:00
parent 32f14b3027
commit a69791b7f5
2 changed files with 7 additions and 1 deletions

View File

@@ -53,7 +53,7 @@ function extractOrigin(url: string): string {
const URL_IN_CSS_REF = /url\((?:'([^']*)'|"([^"]*)"|([^)]*))\)/gm;
const RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;
const DATA_URI = /^(data:)([\w\/\+]+);(charset=[\w-]+|base64).*,(.*)/gi;
const DATA_URI = /^(data:)([\w\/\+\-]+);(charset=[\w-]+|base64).*,(.*)/i;
export function absoluteToStylesheet(cssText: string, href: string): string {
return cssText.replace(URL_IN_CSS_REF, (origin, path1, path2, path3) => {
const filePath = path1 || path2 || path3;