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

Do not strip spaces from base64 #46

Open
josephscott opened this issue Jan 24, 2018 · 1 comment
Open

Do not strip spaces from base64 #46

josephscott opened this issue Jan 24, 2018 · 1 comment

Comments

@josephscott
Copy link

The minification process strips out spaces from base64 strings - https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port/blob/master/src/Minifier.php#L388

But I ran into a case where doing this actually broke previously working PNG images. It turns out that browsers are very forgiving about invalid characters in base64 strings.

I put together an example of this in action at https://josephscott.org/tests/base64-spaces/

For now I've commented out the three lines that remove the spaces.

Ultimately, because of the looseness of browsers supporting these types of base64 strings, I think the minification process should NOT strip spaces by default. Then we could have an option that would turn it on. That would make things more safe by default, and still give those who knew it was ok to strip out their spaces, an easy way to do that.

@tubalmartin
Copy link
Owner

Thank you for reporting this behavior. I'll look into this.

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

No branches or pull requests

2 participants