Prevent crash on URLs delimited by single quotes

This commit is contained in:
Emi Simpson 2019-12-06 11:52:31 -05:00
parent 7412d663e0
commit 90e6cb1c45
No known key found for this signature in database
GPG key ID: 68FAB2E2E6DFC98B

View file

@ -89,7 +89,7 @@ pub fn resolve_css_imports(
) -> String { ) -> String {
let mut resolved_css = String::from(css_string); let mut resolved_css = String::from(css_string);
let re = let re =
Regex::new(r###"(?P<import>@import )?url\((?P<to_repl>"?(?P<url>[^"]+)"?)\)"###).unwrap(); Regex::new(r###"(?P<import>@import )?url\((?P<to_repl>['"]?(?P<url>[^"'\)]+)['"]?)\)"###).unwrap();
for link in re.captures_iter(&css_string) { for link in re.captures_iter(&css_string) {
let target_link = link.name("url").unwrap().as_str(); let target_link = link.name("url").unwrap().as_str();