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

Avoid division by zero in site logo block #38808

Merged
merged 1 commit into from
Feb 16, 2022
Merged

Conversation

audrasjb
Copy link
Contributor

Description

Check whether width and height attributes exist or not before using a division, to avoid dividing by zero.

Testing Instructions

  1. Install a plugin to make sure you can upload SVGs to your website
  2. Add a Site logo block
  3. Use the SVGs
  4. See the notice thrown by the block server-side rendering

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).
  • I've updated related schemas if appropriate.

@audrasjb audrasjb requested a review from ajitbohra as a code owner February 15, 2022 09:00
@Mamaduka Mamaduka added [Block] Site Logo Affects the Site Logo Block [Type] Bug An existing feature does not function as intended Backport to WP Minor Release Pull request that needs to be backported to a WordPress minor release labels Feb 16, 2022
Copy link
Member

@aristath aristath left a comment

Choose a reason for hiding this comment

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

Looks good to me! 👍

@Mamaduka Mamaduka merged commit efc835c into trunk Feb 16, 2022
@Mamaduka Mamaduka deleted the audrasjb-patch-38807 branch February 16, 2022 11:43
@github-actions github-actions bot added this to the Gutenberg 12.7 milestone Feb 16, 2022
@Mamaduka Mamaduka removed the Backport to WP Minor Release Pull request that needs to be backported to a WordPress minor release label Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Site Logo Affects the Site Logo Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Site Logo Block causing division by zero notice when image dimensions are not available
3 participants