Skip to content

Fix the fromContentUri null/short path causes substring crash#4497

Open
siddhesh-06 wants to merge 1 commit intoTeamAmaze:release/4.0from
siddhesh-06:siddhesh06/fix/fromContentUri-null-check
Open

Fix the fromContentUri null/short path causes substring crash#4497
siddhesh-06 wants to merge 1 commit intoTeamAmaze:release/4.0from
siddhesh-06:siddhesh06/fix/fromContentUri-null-check

Conversation

@siddhesh-06
Copy link
Contributor

Description

  1. Implemented null-safety for uri.getPath()
  2. Added validation of the expected provider prefix before performing any substring operations to avoid unsafe assumptions about URI structure.
  3. Added fallback behaviour for unexpected or short paths & improved logging
  4. Prevented crashes when the constructed file does not exist

Issue tracker

Fixes #4477

Automatic tests

  • Added test cases

Manual tests

  • Done

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

@VishnuSanal VishnuSanal added the PR-Awaiting-Initial-Review this PR is awaiting for an initial review label Mar 21, 2026
Copy link
Member

@VishnuSanal VishnuSanal left a comment

Choose a reason for hiding this comment

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

LGTM 🚀 thanks! :)

@VishnuSanal VishnuSanal added PR-Awaiting-Final-Review this PR is awaiting a final review/approval and removed PR-Awaiting-Initial-Review this PR is awaiting for an initial review labels Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Awaiting-Final-Review this PR is awaiting a final review/approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fromContentUri] Null/short path causes substring crash

2 participants