The paths of resources below the root of a share, and the hrefs that name them.
A path is a vector of decoded segments below the root, e.g. ["notes" "a b.edn"], and [] is the root itself. Each segment is in Unicode's normalization form C, so that café names one resource however a client writes it. An href is an absolute path with each segment percent-encoded, as RFC 4918, section 8.3, allows, e.g. /dav/notes/a%20b.edn. The percent-encoding is whatwg-url's, so it's the same on every platform.
The paths of resources below the root of a share, and the hrefs that name them. A path is a vector of decoded segments below the root, e.g. ["notes" "a b.edn"], and [] is the root itself. Each segment is in Unicode's normalization form C, so that café names one resource however a client writes it. An href is an absolute path with each segment percent-encoded, as RFC 4918, section 8.3, allows, e.g. /dav/notes/a%20b.edn. The percent-encoding is whatwg-url's, so it's the same on every platform.
(href root path)(href root path collection?)The href of the path below the root of a share, with a trailing
slash when it's a collection?. A segment that can't name a resource
(see segment?), e.g. .., throws.
(href "/dav/" ["notes" "a b.edn"])
;; => "/dav/notes/a%20b.edn"
The href of the `path` below the `root` of a share, with a trailing
slash when it's a `collection?`. A segment that can't name a resource
(see segment?), e.g. .., throws.
(href "/dav/" ["notes" "a b.edn"])
;; => "/dav/notes/a%20b.edn"(name href)The decoded last segment of the href, a URL or a path, e.g. a b.edn
for /dav/notes/a%20b.edn. It's empty for the root of a server.
The decoded last segment of the `href`, a URL or a path, e.g. a b.edn for /dav/notes/a%20b.edn. It's empty for the root of a server.
(parent path)The path of the collection that holds the resource at path, or nil
for the root.
The path of the collection that holds the resource at `path`, or nil for the root.
(parse root s)The path of the percent-encoded absolute path s, e.g. the :uri of a
Ring request, below the root of a share. It's nil when s isn't below
the root, and :invalid when a segment can't name a resource (see
segment?). The root matches by its decoded segments, so that e.g.
/simon%40example.com/ is below the root /simon@example.com/ too.
(parse "/dav/" "/dav/notes/a%20b.edn")
;; => ["notes" "a b.edn"]
The path of the percent-encoded absolute path `s`, e.g. the :uri of a
Ring request, below the `root` of a share. It's nil when `s` isn't below
the root, and :invalid when a segment can't name a resource (see
segment?). The root matches by its decoded segments, so that e.g.
/simon%40example.com/ is below the root /simon@example.com/ too.
(parse "/dav/" "/dav/notes/a%20b.edn")
;; => ["notes" "a b.edn"](resolve root base s)The path of the URL or absolute path s below the root of a share,
resolved against the absolute path base, e.g. the :uri of the request.
Only the path of the URL counts. It's nil when s isn't a URL or isn't
below the root, and :invalid as for parse.
The path of the URL or absolute path `s` below the `root` of a share, resolved against the absolute path `base`, e.g. the :uri of the request. Only the path of the URL counts. It's nil when `s` isn't a URL or isn't below the root, and :invalid as for parse.
(root s)The s as the root of a share: an absolute path with a slash at each
end, e.g. /dav/ for dav. The other functions take a root in this form.
The `s` as the root of a share: an absolute path with a slash at each end, e.g. /dav/ for dav. The other functions take a root in this form.
(segment? s)Whether the decoded segment s can name a resource: neither . nor ..,
and without a slash, a backslash, a control character or the U+FFFD
that bytes that aren't UTF-8 decode to.
Whether the decoded segment `s` can name a resource: neither . nor .., and without a slash, a backslash, a control character or the U+FFFD that bytes that aren't UTF-8 decode to.
(segments s)The decoded segments of the percent-encoded path s, without the empty
ones, or :invalid when a segment can't name a resource.
The decoded segments of the percent-encoded path `s`, without the empty ones, or :invalid when a segment can't name a resource.
(within? ancestor path)Whether the path is the path ancestor or below it.
Whether the `path` is the path `ancestor` or below it.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |