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

Ensure all sanitizers run when building featured image #1092

Merged
merged 1 commit into from
Apr 20, 2018

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented Apr 20, 2018

This is a regression introduced by #882 in c62dad6.

This ensures that the amp-anim script, for example, will be assured to be included. It also ensures that if a plugin adds other markup to a featured image via the post_thumbnail_html filter that it will be properly sanitized.

Fixes #1090.

Copy link
Contributor

@kienstra kienstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works As Expected
Question About Argument

Hi @westonruter,
Thanks, this works well. Images still display as expected in the legacy template (which uses AMP_Post_Template).

There's only one question here, but it might not need any action. I'm happy to approve this soon.

@@ -349,7 +349,7 @@ private function build_post_featured_image() {

list( $sanitized_html, $featured_scripts, $featured_styles ) = AMP_Content_Sanitizer::sanitize(
$featured_html,
array( 'AMP_Img_Sanitizer' => array() ),
amp_get_content_sanitizers( $post_id ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this pass a WP_Post instead of $post_id? It looks like amp_get_content_sanitizers() expects a WP_Post as the argument.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kienstra Good catch. Fixed in 5045563

This ensures that the amp-anim script, for example, will be assured to be included. It also ensures that if a plugin adds other markup to a featured image via the post_thumbnail_html filter that it will be properly sanitized.
@kienstra
Copy link
Contributor

Approved

Hi @westonruter,
Thanks, this looks good.

@westonruter westonruter merged commit 5a00ad6 into 0.7 Apr 20, 2018
@westonruter westonruter deleted the fix/featured-image-anim branch April 20, 2018 21:44
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 this pull request may close these issues.

2 participants