Prevent crash on URLs delimited by single quotes

pull/78/head
Emi Simpson 5 years ago
parent 7412d663e0
commit 90e6cb1c45
No known key found for this signature in database
GPG Key ID: 68FAB2E2E6DFC98B

@ -89,7 +89,7 @@ pub fn resolve_css_imports(
) -> String {
let mut resolved_css = String::from(css_string);
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) {
let target_link = link.name("url").unwrap().as_str();

Loading…
Cancel
Save