-
Notifications
You must be signed in to change notification settings - Fork 382
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
Strip leading BOM+whitespace and trailing HTML comment before parsing validation response JSON #4679
Conversation
…sing validation response JSON
Build for testing: amp.zip (1.5.4-alpha-20200510T191400Z-314ee33d9) |
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.
Neat. LGTM.
…sing validation response JSON (#4679)
@@ -2114,6 +2114,17 @@ public static function validate_url( $url ) { | |||
$validation_url | |||
); | |||
|
|||
// Strip byte order mark (BOM). | |||
if ( "\xEF\xBB\xBF" === substr( $response, 0, 3 ) ) { |
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 would have turned this into a while
loop, as under certain circumstances, some systems prepend the BO without checking if there is one already. So you can end up with multiple ones as well.
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.
Good point. Done in #4683.
…/reader-mode-themes * 'develop' of github.com:ampproject/amp-wp: (59 commits) Strip multiple BOM characters (#4683) Strip leading BOM and whitespace and trailing HTML comment before parsing validation response JSON (#4679) Update dependency xwp/wp-dev-lib to v1.6.4 Update dependency eslint to v7 Remove unused RuntimeException Use explicit string type instead of generic array in return Avoid method map and replace with a switch Defer removal of attributes until after layout application Fix post preview in Reader mode (#4665) Ensure that source map comment is preserved at the end of amp-custom.css Pass DOMAttr instances rather than attribute name and value as separate args Enable SSR by default, remove use of WP_DEBUG as a signal. (#4669) Use padding-top and override regular inline style for heights Update php-parallel-lint dependency to new name Use :first-child to reference sizer in CSS Update dependency @wordpress/babel-preset-default to v4.12.1 (#4494) Fix error type for bad sizes test Provide more precise error for thrown exception Test precise error messages Fix attribute name in error messages ...
…ve-collection-schema-type * 'develop' of github.com:ampproject/amp-wp: Raise PHPStan level to 4 in lib/common (#4686) Update dependency uuid to v8 Update dependency webpack to v4.43.0 Update dependency eslint-plugin-jest to v23.11.0 Update dependency eslint-plugin-react to v7.20.0 (#4691) Update dependency postcss to v7.0.30 (#4649) Update dependency moment to v2.25.3 (#4639) Update dependency babel-jest to v26 (#4652) Update dependency uuid to v7.0.3 (#4490) Update dependency wp-coding-standards/wpcs to v2.3.0 (#4721) Suppress Site Health ICU test if site or home URL is not an IDN (#4698) Pin amp-experiment to v0.1 (#4690) Strip multiple BOM characters (#4683) Strip leading BOM and whitespace and trailing HTML comment before parsing validation response JSON (#4679) Disable share icons Use amp-embedly-card for Tiktok embeds Update dependency xwp/wp-dev-lib to v1.6.4 Update dependency eslint to v7 Update dependency terser-webpack-plugin to v2.3.6
Summary
Fixes #4678
Checklist