Skip to content

fix(filemanager): don't split SAF content URIs in BreadcrumbBar - #160

Merged
CallMeTechie merged 2 commits into
masterfrom
fix/saf-breadcrumb-uri-preservation
Apr 21, 2026
Merged

CallMeTechie merged 2 commits into
masterfrom
fix/saf-breadcrumb-uri-preservation

Conversation

@CallMeTechie

Copy link
Copy Markdown
Owner

User-reported after v0.33.11:

Invalid URI: /content:/com.android.externalstorage.documents/tree
  at DocumentsContract.getTreeDocumentId

Leading slash + 'content:/' (single slash) + no tree-ID = shape produced only by splitting 'content://…/tree/primary%3A…' on '/' and rejoining. That's exactly what BreadcrumbBar did indiscriminately.

Fix: short-circuit to a non-clickable display label for content:// paths. navigateUp's pathStack pop already handles 'go back' for SAF.

User-reported after installing v0.33.11: tapping into a SAF-granted
folder still errors with

    Invalid URI: /content:/com.android.externalstorage.documents/tree
       at DocumentsContract.getTreeDocumentId

The log shows the clue: the URI at the IllegalArgumentException has a
leading slash, 'content:/' (single slash), and no tree-ID — a shape
produced only by splitting the original 'content://…/tree/primary%3A…'
on '/' and rejoining. That is exactly what BreadcrumbBar did for every
path, SAF or POSIX.

Fix: detect content://-prefixed paths and short-circuit to a single
non-clickable label with the decoded document display name. SAF has
no cross-tree parent concept anyway (DocumentsContract cannot walk
above a granted tree root), so per-segment Breadcrumbs were only ever
meaningful for SSH/FTP paths. The 'go back' path for SAF already
works via [FileManagerViewModel.navigateUp]'s pathStack pop.

Helper: safDisplayLabel() decodes either a /tree/ or /document/
suffix and returns the last POSIX-style segment after the authority
prefix, falling back to the raw URI on any parse failure.
@CallMeTechie
CallMeTechie enabled auto-merge (squash) April 21, 2026 14:56
CallMeTechie added a commit that referenced this pull request Apr 21, 2026
Wear was the first module to hit the bcprov x jspecify OSGI
manifest duplicate (PR #158 pulled bcprov into :core:core-security,
every Android module inheriting :core:core-security now ships the
conflicting resource). :app had already guarded against it; :wear
was fixed in the previous commit on this branch.

But feature-settings' test APK failed with the same error on PR
#160's CI, and tracking down which module transitively gets bcprov
on the next dependency change is operational churn we don't need.

Move the exclude into root build.gradle.kts via a subprojects
plugin-withId block — applies to every com.android.library and
com.android.application subproject without per-module bookkeeping.
Revert the now-redundant wear-only exclude added two commits ago.

Local verify: :app, :wear, :feature-settings:assembleDebugAndroidTest
all green. detekt clean.
CallMeTechie added a commit that referenced this pull request Apr 21, 2026
* fix(wear): exclude OSGI META-INF to unblock bcprov packaging

Release build of v0.33.12 (PR #158) failed at :wear:mergeRelease
JavaResource because bcprov-jdk18on 1.80 and jspecify 1.0.0 both
ship META-INF/versions/9/OSGI-INF/MANIFEST.MF. The :app module
already excluded this path; :wear did not, because wear never
pulled in bcprov before — it does now via the shared
:core:core-security dependency (BouncyCastleSetup lives there).

Add a packaging resources block to wear/build.gradle.kts
mirroring the app exclusion list. OSGI metadata is not used by
Android runtime, so dropping it is safe.

* fix(build): centralise OSGI META-INF exclude in root build.gradle

Wear was the first module to hit the bcprov x jspecify OSGI
manifest duplicate (PR #158 pulled bcprov into :core:core-security,
every Android module inheriting :core:core-security now ships the
conflicting resource). :app had already guarded against it; :wear
was fixed in the previous commit on this branch.

But feature-settings' test APK failed with the same error on PR
#160's CI, and tracking down which module transitively gets bcprov
on the next dependency change is operational churn we don't need.

Move the exclude into root build.gradle.kts via a subprojects
plugin-withId block — applies to every com.android.library and
com.android.application subproject without per-module bookkeeping.
Revert the now-redundant wear-only exclude added two commits ago.

Local verify: :app, :wear, :feature-settings:assembleDebugAndroidTest
all green. detekt clean.
@CallMeTechie
CallMeTechie merged commit db9ccfd into master Apr 21, 2026
12 checks passed
@CallMeTechie
CallMeTechie deleted the fix/saf-breadcrumb-uri-preservation branch April 21, 2026 15:57
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.

1 participant