Skip to content

Commit

Permalink
Escape brackets (#29857)
Browse files Browse the repository at this point in the history
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
  • Loading branch information
MartijnCuppens and XhmikosR committed Dec 26, 2019
1 parent 32864c5 commit 66bbc5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scss/_functions.scss
Expand Up @@ -52,7 +52,12 @@
@function escape-svg($string) {
@if str-index($string, "data:image/svg+xml") {
@each $char, $encoded in $escaped-characters {
$string: str-replace($string, $char, $encoded);
// Do not escape the url brackets
@if str-index($string, "url(") == 1 {
$string: url("#{str-replace(str-slice($string, 6, -3), $char, $encoded)}");
} @else {
$string: str-replace($string, $char, $encoded);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions scss/_variables.scss
Expand Up @@ -106,6 +106,8 @@ $escaped-characters: (
("<","%3c"),
(">","%3e"),
("#","%23"),
("(","%28"),
(")","%29"),
) !default;


Expand Down

0 comments on commit 66bbc5f

Please sign in to comment.