Expand description
Escape strings for use in ostree refs.
It can be desirable to map arbitrary identifiers, such as RPM/dpkg
package names or container image references (e.g. docker://quay.io/examplecorp/os:latest)
into ostree refs (branch names) which have a quite restricted set
of valid characters; basically alphanumeric, plus /, -, _.
This escaping scheme uses _ in a similar way as a \ character is
used in Rust unicode escaped values. For example, : is _3A_ (hexadecimal).
Because the empty path is not valid, // is escaped as /_2F_ (i.e. the second / is escaped).
Functionsยง
- escape_
for_ ๐ref - Escape a single string; this is a backend of
prefix_escape_for_ref. - prefix_
escape_ for_ ref - Compute a string suitable for use as an OSTree ref, where
scan be a (nearly) arbitrary UTF-8 string. This requires a non-empty prefix. - unescape_
for_ ๐ref - Reverse the effect of
escape_for_ref(). - unprefix_
unescape_ ref - Remove a prefix from an ostree ref, and return the unescaped remainder.