Skip to content

Commit

Permalink
fix: handling string urls with backslash and newline (#1012)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Dec 10, 2019
1 parent b59c4f2 commit 8e8ab18
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 769 deletions.
4 changes: 4 additions & 0 deletions src/plugins/postcss-url-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ function getUrlsFromValue(value, result, filter, decl) {
if (!isStringNode && /\\["'() \t\n]/.test(normalizedUrl)) {
normalizedUrl = normalizedUrl.replace(/\\(["'() \t\n])/g, '$1');
}
// https://drafts.csswg.org/css-values-4/#strings
else if (isStringNode && /\\[\n]/.test(normalizedUrl)) {
normalizedUrl = normalizedUrl.replace(/\\[\n]/g, '');
}

urls.push({ node, url: normalizedUrl, hash, needQuotes });
});
Expand Down
Loading

0 comments on commit 8e8ab18

Please sign in to comment.