OpenFolia

Read an image

GET
/assets/{hash}

With width (320, 640 or 1280): the image as a WebP at most that wide (never upscaled; at most four times as tall), made on first request and kept in the blob store, after the same checks as the original (404 where the original is 404); a file other than a PNG, JPEG, GIF or WebP image has none (400). Images are content-addressed: modules refer to them as sha256:<hash>, and the bytes live in the blob store (older content: assets/<hash> in the repository). Only an image a module the reader may see refers to is served; any other is 404, like a missing one. Streamed with the stored type (sniffed for the old layout), X-Content-Type-Options: nosniff and a sandboxing Content-Security-Policy, so author-supplied SVGs can never run scripts; a type other than an image is sent as an attachment. A file an attachment block the reader may see attaches is always a download (Content-Disposition: attachment with an RFC 8187 filename*), under the file name of the first such block that fits the stored type, else the hash. Cached like every content route: private, max-age=31536000, immutable when ?ref= is a commit ID, else private, no-cache with an ETag (who may see an image can change, its bytes cannot).

Authorization

bearer
headerAuthorizationBearer <JWT>

A service account's token (ccms_sat_…, issued by POST /service-accounts/{id}/tokens), or, for local use and demo mode, the server's shared CCMS_API_TOKEN.

Path Parameters

hash*string

SHA-256 of the file, 64 hex characters.

Match^[a-f0-9]{64}$

Query Parameters

width?string

A rendition instead of the file: a WebP at most this many pixels wide (320, 640, 1280), never upscaled. Only for PNG, JPEG, GIF and WebP images.

Value in"320""640""1280"
ref?string

Branch, tag or commit ID to read from. Default: the server's CCMS_DEFAULT_REF.

Response Body

The image or attached file, with its stored type (any type for an attachment).

response?unknown
Example Request
curl -X GET 'http://localhost:3000/assets/string'
Example Response
null