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

Image sanitizer only verifies if size (width/height) is not set, but doesn't validate empty values #561

Closed
rcstr opened this issue Nov 3, 2016 · 1 comment

Comments

@rcstr
Copy link

rcstr commented Nov 3, 2016

This piece validates is param is set, but in some cases images size is being set with an empty value which this function wouldn't validate. Empty values caused AMP validator to fail

// Try to extract dimensions for the image, if not set.
if ( ! isset( $new_attributes['width'] ) || ! isset( $new_attributes['height'] ) ) {
  $dimensions = AMP_Image_Dimension_Extractor::extract( $new_attributes['src'] );
    if ( is_array( $dimensions ) ) {
      $new_attributes['width'] = $dimensions[0];
      $new_attributes['height'] = $dimensions[1];
    }
}
@rcstr rcstr changed the title Image sanitizer only verifies is size (width/height) is not set, but doesn't validate empty values Image sanitizer only verifies if size (width/height) is not set, but doesn't validate empty values Nov 3, 2016
@westonruter
Copy link
Member

This should be fixed by #979. Please double-check.

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

No branches or pull requests

3 participants