Expand description
Encoding and decoding between S3Location and its various string forms.
Three distinct output forms:
- Canonical URI (
brows3r://<profile_id>/<bucket>/<key>) — used for Copy Path, navigation state, and any IPC surface that must be unambiguous even when two profiles share a display name. - Display path —
DisplayPathfor the breadcrumb UI. Human-readable, not URL-encoded. - Clipboard string (
s3://<bucket>/<key>) — the aws-cli-compatible form users paste into a terminal.
§Percent-encoding rules
The canonical URI encodes bucket names and the full key/prefix string using
percent-encoding’s NON_ALPHANUMERIC set (encodes everything except
[A-Za-z0-9]), then un-encodes / back to a literal / in the key
segment only. This preserves the S3 hierarchy-separator semantics while
ensuring that ?, #, %, and other special characters are always
escaped.
Bucket names are encoded without slash restoration (S3 bucket names cannot
contain /).
Functions§
- decode_
component 🔒 - Percent-decode a URI component, returning a UTF-8 string.
- encode_
no_ 🔒slash - Percent-encode a string, encoding ALL non-alphanumeric characters
(including
/). Used for bucket names. - encode_
preserve_ 🔒slash - Percent-encode a string, encoding all non-alphanumeric characters EXCEPT
/. Used for key/prefix segments. - from_
canonical_ uri - Parse a
brows3r://URI back into anS3Location. - from_
display_ path - Reconstruct an
S3Locationfrom breadcrumb segments. - to_
canonical_ uri - Encode an
S3Locationinto its canonicalbrows3r://URI. - to_
clipboard_ string - Produce the aws-cli-compatible
s3://string for clipboard use. - to_
display_ path - Build a
DisplayPathfrom anS3Location.