Skip to content

fix(android): preserve encoded content URIs - #1040

Open
ngocdevv wants to merge 1 commit into
wonday:masterfrom
ngocdevv:codex/fix-android-content-uri
Open

fix(android): preserve encoded content URIs#1040
ngocdevv wants to merge 1 commit into
wonday:masterfrom
ngocdevv:codex/fix-android-content-uri

Conversation

@ngocdevv

Copy link
Copy Markdown

Summary

  • Preserve Android content:// source URIs exactly as received.
  • Continue decoding file:// and other local paths, retaining support for encoded spaces and accented filenames.

Problem

Android scoped URI permissions are keyed by the exact URI. The current local-source path runs every URI through decodeURIComponent, so a granted URI such as:

content://com.android.providers.downloads.documents/document/msf%3A6179

becomes .../msf:6179 before it reaches ContentResolver. That no longer matches the temporary permission granted by Android.

Fix

Detect content:// sources before normalizing the local path and pass those URIs through unchanged. All non-content local sources keep the existing decoding behavior, including the accented-filename fix from #873.

Testing

  • Focused Jest regression check against Pdf#_prepareFile:
    • content://.../msf%3A6179 remains byte-for-byte unchanged.
    • file:///documents/R%C3%A9sum%C3%A9%20final.pdf still becomes /documents/Résumé final.pdf.
  • node --check index.js
  • git diff --check
  • npm pack --dry-run --ignore-scripts

Closes #990.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android scoped permission is messed up by decodeURIComponent

1 participant