Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should not process urls with protocol data: #7

Open
inian opened this issue Dec 23, 2015 · 8 comments · May be fixed by #10
Open

Should not process urls with protocol data: #7

inian opened this issue Dec 23, 2015 · 8 comments · May be fixed by #10

Comments

@inian
Copy link

inian commented Dec 23, 2015

Right now URLs in css like

.haha {
 filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale")
}

gets changed to

.haha {
  filter: url("data:image/svg+xml;utf8,<svg xmlns=http://www.w3.org/2000/svg><filter id=grayscale><feColorMatrix type=matrix values=0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0/></filter></svg>#grayscale");
}

when run with the plugin with no transformations to the URL.

The bug is that the quotes get stripped off, leading to an invalid inline SVG

@ebess
Copy link

ebess commented Sep 6, 2016

👍

@rmaspero
Copy link

rmaspero commented Aug 3, 2017

Would be nice for it to leave data urls alone

@kromakollision
Copy link

You could add a test in your rework function to check for the data protocol. If present just the return the original url:
if(url.indexOf('data:image') >= 0) return url;

@mpdude
Copy link

mpdude commented Jan 11, 2018

Please check if #10 helps

@techwes
Copy link

techwes commented Feb 20, 2018

Can someone get to merging the above PR? This is causing production issues for me and it would be nice if I didn't have to point to my own fork with this patched

@xsonic
Copy link

xsonic commented Aug 16, 2018

Would like to see this merged, too.

@mpdude
Copy link

mpdude commented Jan 3, 2020

Took care of the remaining remark in #10. Let's see if it gets merged and a new version released.

@techwes
Copy link

techwes commented Jan 3, 2020

Posted this on another issue but will put it here as well. Since there are no commits on since 2015 I do not think it is maintained any longer. So I wouldn't get your hopes up that any PRs will be merged.

After using a forked version for a little while I ended up switching to use PostCSS Url which is still maintained. If you are already using the popular Autoprefixer then you are also using PostCSS which makes adding PostCSS Url pretty easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants