ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Server.Path

Description

Artifact names and URL-component encoding shared by ecosystem routers. Ecluse.Core.Text owns the component gate also used by outbound metadata.

Synopsis

The artifact name

data Filename Source #

An artifact's on-the-wire file name, verbatim and safe to interpolate: it cleared isSafeComponent. The upstream path uses this exact name, never one rebuilt from the version.

Instances

Instances details
Show Filename Source # 
Instance details

Defined in Ecluse.Core.Server.Path

Eq Filename Source # 
Instance details

Defined in Ecluse.Core.Server.Path

mkFilename :: Text -> Maybe Filename Source #

Read a filename from untrusted text, Nothing when it is not a safe path component. Every boundary that admits one (a route capture, a queue payload) parses through this single gate.

unFilename :: Filename -> Text Source #

The verbatim name, for interpolation into an upstream URL through encodeComponent.

Component safety

isSafeComponent :: Text -> Bool Source #

Refuse empty components, traversal, separators, and controls. Callers must still percent-encode on URL construction.

encodeComponent :: Text -> Text Source #

Encode a decoded component using only RFC 3986 unreserved bytes verbatim. Encoding is not idempotent: a literal percent sign becomes %25.