fix: HTML parser handling img attributes with float values#685
Merged
hejsztynx merged 4 commits intoJul 9, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a crash in the Android HTML parser when <img> width/height attributes contain float values (e.g. 30.000000), improving cross-platform HTML compatibility (Web/iOS → Android).
Changes:
- Replace
Integer.parseIntfor<img>dimensions with a safer float-tolerant parsing helper. - Add
parseDimension(String)to convert float-like dimension strings intointvalues without throwing.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kacperzolkiewski
approved these changes
Jul 8, 2026
Collaborator
|
I think we should improve HTML generation on iOS in a separate PR and make sure integer values are displayed without the |
2 tasks
# Summary Now the `img` attributes are converted to integer. It's truthful to official HTML5 specifications, where `width` and `height` should be integer values and the floating point in HTML could be destructive, which could produce a similar issue as in #685 ## Screenshots When adding an image via modal with `height` and `width` set to `30` Before: <img width="341" height="331" alt="image" src="https://github.com/user-attachments/assets/f905c3c9-7f6e-4bb7-86ec-235e9668c37c" /> After: <img width="334" height="326" alt="image" src="https://github.com/user-attachments/assets/2c1dae24-693a-4c9a-84cf-418865837a7e" /> ## Compatibility | OS | Implemented | | ------- | :---------: | | iOS | ✅ | | Android | ❌ | | Web | ❌ | ## Checklist - [ ] E2E tests are passing - [ ] Required E2E tests have been added (if applicable)
Collaborator
Author
that's a oneline fix, and in a shared scope, I'll introduce it in this PR |
exploIF
approved these changes
Jul 8, 2026
exploIF
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HTML parser on Android explicitly tired to parse
<img>dimension attributesheightandwidthasInteger, with no exception caught, which caused the whole parser to bail. Web and iOS outputs HTML with float dimensions, so using that HTML in Android would break the input.Also I got rid of the core cause of this issue - made the iOS parser function the same as the Android one and they both now converts both dimension attributes to integer values. #688
Testing
Example HTML that would break if used in
Set input's valueScreenshots / Videos
iOS on the left, Android on the right
Before:
img-parsing2.mov
After:
img-parsing2-after.mov
Compatibility
Checklist