March Docs

StaticAssets

static_assets.march — Serve Scroll's bundled browser assets.

Scroll ships its editor, chart renderer, styles and fonts under <archive_root>/assets so a notebook opens with no network access. This module maps a request path under /assets/ to a file there, refusing any path that could leave the directory.

Functions

fncontent_typecontent_type(name : String) : String#

The Content-Type for a file name, by extension.

fnsafe_relativesafe_relative(rel : String) : Bool#

True when rel names a file beneath the assets directory: non-empty, relative, and with no empty, . or .. segment or backslash.

fnserveserve(conn, dir : String, rel : String)#

Respond with the asset at rel under dir, or 404.