Skip to content

Fix crash when push notification icon URL has illegal characters - #23138

Merged
adalpari merged 1 commit into
trunkfrom
adalpari/salvador
Jul 23, 2026
Merged

Fix crash when push notification icon URL has illegal characters#23138
adalpari merged 1 commit into
trunkfrom
adalpari/salvador

Conversation

@adalpari

@adalpari adalpari commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes JETPACK-ANDROID-1BYM

Incoming push notifications can carry an icon URL that, after URLDecoder.decode, contains an illegal character such as an unencoded space (e.g. .../uploads/Board Logo/cropped-...png). That decoded URL flows into ImageUtils.downloadBitmap, which builds a java.net.URI and throws an unchecked IllegalArgumentException ("Illegal character in path"). Because it was uncaught, a single malformed icon URL crashed the entire Firebase push-message handler (fatal, UncaughtExceptionHandler).

ImageUtils.downloadBitmap lives in the external WordPress-Utils-Android library and can't be changed here, so the fix is in the caller: the existing catch in getLargeIconBitmap now also handles IllegalArgumentException. A malformed icon URL is logged and the notification is shown without the large icon instead of crashing.

This is the only large-icon entry point, so the other notification code paths that call getLargeIconBitmap are covered as well.

Testing instructions

This crash requires a push notification whose icon field decodes to a URL containing an illegal character (e.g. a space), which is hard to reproduce on demand. Since the PR just handling a new exception, green CI should be enough

A push notification icon URL that decodes to an illegal character (e.g. an
unencoded space) caused ImageUtils.downloadBitmap to throw an unchecked
IllegalArgumentException, crashing the entire Firebase push-message handler.
Widen the catch in getLargeIconBitmap to skip the large icon instead.

Fixes JETPACK-ANDROID-1BYM

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dangermattic

dangermattic commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@adalpari
adalpari marked this pull request as ready for review July 23, 2026 11:29
@wpmobilebot

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
Build TypeDebug
Versionpr23138-f846cca
Build Number1498
Application IDcom.jetpack.android.prealpha
Commitf846cca
Installation URL1nn2gha2pkpj8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr23138-f846cca
Build Number1498
Application IDorg.wordpress.android.prealpha
Commitf846cca
Installation URL37plblcnctuh8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@adalpari
adalpari requested a review from nbradbury July 23, 2026 11:38

@nbradbury nbradbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! :shipit:

@adalpari
adalpari merged commit 64302cb into trunk Jul 23, 2026
26 checks passed
@adalpari
adalpari deleted the adalpari/salvador branch July 23, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants