-
Notifications
You must be signed in to change notification settings - Fork 383
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
Remove space from 'data: url()' in stylesheets #1164
Conversation
8cc7e34
to
bbb254f
Compare
tests/test-amp-style-sanitizer.php
Outdated
* Test handling of stylesheets with spaces in the background-image URLs. | ||
* | ||
* @dataProvider get_data_urls | ||
* @covers AMP_Style_Sanitizer::normalize_urls() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is covering AMP_Style_Sanitizer::remove_spaces_from_data_urls()
now, right?
tests/test-amp-style-sanitizer.php
Outdated
* @param string $source Source URL string. | ||
* @param string|null $expected Expected normalized URL string. | ||
*/ | ||
public function test_normalize_urls( $source, $expected ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise, test_ remove_spaces_from_data_urls
tests/test-amp-style-sanitizer.php
Outdated
'url_with_spaces' => array( | ||
'html { background-image:url(url with spaces.png); }', | ||
'html{background-image:url("urlwithspaces.png")}', | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should include data:
URL as discussed. Include spaces as reported in support forums.
if ( empty( $base_url ) ) { | ||
return; | ||
} | ||
private function normalize_urls( $urls, $stylesheet_url = '' ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most of the changes to normalize_urls
should be reverted back to real_path_urls
because as we found out, the PHP CSS parser fails to parse URLs with spaces in them anyway, so this will never be fed any such URLs. The added comments should be retained, of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted all, except some new code comments.
$options['stylesheet_url'] | ||
); | ||
} | ||
$this->normalize_urls( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per below, I think this change can be reverted.
Fixes #1089