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

[Mobile] Hotfix release v1.3.1 - Fix crash on undefined image url #15618

Merged

Conversation

mkevins
Copy link
Contributor

@mkevins mkevins commented May 14, 2019

Description

Note: This PR targets the gutenberg branch used for the v1.3.0 release of gutenberg-mobile, which is used in WordPress-Android v12.3.1.

This PR adds a check to ensure attributes.url exists before attempting to call indexOf. Currently, there are scenarios which can result in attributes.id being truthy, while attributes.url is null or undefined for an image block.

When an image is cancelled before it is finished uploading, the url is set to null, but the id of the block remains. The next time the post is edited, the local draft will contain the state which triggers the crash.

How has this been tested?

This was tested using the steps here: wordpress-mobile/WordPress-Android#9768 (comment)

Types of changes

This is a bug fix for the crash discovered here: wordpress-mobile/WordPress-Android#9768

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@mkevins mkevins added [Type] Bug An existing feature does not function as intended Mobile Web Viewport sizes for mobile and tablet devices [Block] Image Affects the Image Block labels May 14, 2019
@daniloercoli daniloercoli self-requested a review May 14, 2019 09:56
Copy link
Contributor

@daniloercoli daniloercoli left a comment

Choose a reason for hiding this comment

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

Tested by following instructions provided in wordpress-mobile/WordPress-Android#9856

LGTM!

@mkevins mkevins merged commit 5954265 into gbmobile/disable-list-block-on-android May 14, 2019
@mkevins mkevins deleted the rnmobile/hotfix-release-v1.3.1 branch May 14, 2019 09:58
@youknowriad youknowriad modified the milestone: 5.7 (Gutenberg) May 14, 2019
@gziolo gziolo added Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) and removed Mobile Web Viewport sizes for mobile and tablet devices labels Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants