Change more path handlers to support prefix RIs - #5741
Draft
backspace wants to merge 2 commits into
Draft
Conversation
`new RealmPaths(new URL(realm))` only works while every realm identifier is URL-shaped. A prefix-form identifier throws `Failed to construct 'URL': Invalid URL` at the constructor, so the code cannot tolerate one even where nothing downstream cares about the form. Use the RealmIdentifier overload instead. It applies the same `ensureTrailingSlash` the URL branch does, so with URL-form identifiers the resulting RealmPaths is identical — this is a no-op today and stops being one only when identifiers change form. Where the value then flowed through a method that requires a URL-based RealmPaths (`fileURL`, `directoryURL`, `local(URL)`), switch to the identifier counterpart (`fileRRI`, `directoryRRI`, `local(RealmResourceIdentifier)`), which returns the same string for a URL-based instance. `create-file-modal` keeps its `fileURL` calls: they feed `cardService.saveSource(url: URL)` and a `Deferred<URL>`, so converting them means widening those signatures. `validate-realm` gains a better error for garbage input — the membership check now reports `Invalid realm: <input>` where the URL constructor reported `Invalid URL`. Co-Authored-By: Claude Opus 5 <[email protected]>
The file chooser modelled a workspace as `{ url: URL }`, parsed from the realm
list's keys. Every use of that URL is a comparison, a render key, or a
`RealmPaths` construction — none need URL structure, and parsing constrains the
realm list to URL-shaped identifiers.
`FileChooserRealm` now carries `id: RealmIdentifier`, and the upload service
takes `realm: RealmIdentifier` in place of `realmURL: URL`, building its target
with `fileRRI` and passing it to the VirtualNetwork-backed `authedFetch` and to
the store — both of which take an identifier.
The file tree still receives the same string it received before (`@realmURL` was
already fed `.url.href`), so the tree keeps its current contract.
Co-Authored-By: Claude Opus 5 <[email protected]>
Contributor
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.
These are more places where realm identifiers are assumed to be URLs.