Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Media Attachments

This document defines the validation rules for the media table in the User Canister. Limits follow the Mastodon defaults to ensure compatibility with the broader fediverse.

media_type

MIME type of the attachment. Enforced by MimeValidator in db-utils.

RuleValue
Formattype/subtype per RFC 6838
Slash countExactly one /
Allowed charsLowercase ASCII graphic (!..=~ minus uppercase)
WhitespaceRejected
Maximum length127 bytes
NullableNo

Examples accepted: image/png, image/jpeg, video/mp4, application/vnd.mastic.v1+json. Examples rejected: Image/png (uppercase), image /png (whitespace), image/png/x (extra slash), imagepng (no slash).

description

Alt-text for the attachment.

RuleValue
SanitizationTrim leading/trailing whitespace
Maximum length1500 characters
Minimum length1 (empty string rejected)
NullableYes
Length unitUnicode scalar values

Enforced by TrimSanitizer + BoundedTextValidator(1500) in db-utils.

blurhash

Compact blurhash preview string. Enforced by BlurhashValidator in db-utils.

RuleValue
AlphabetBase83: 0-9, A-Z, a-z, `#$%*+,-.:;=?@[]^_{
Minimum length6 bytes
Maximum length128 bytes
NullableYes

Blurhash length is a function of the encoded component count. The allowed range covers every valid componentsX × componentsY pairing with a reasonable safety margin on the upper bound to prevent storage blow-up.

bytes

Raw media payload (BLOB). No schema-level validation; size and content-type enforcement happen at the upload-endpoint layer. See WI-1.16 (#59) and WI-1.17 (#67) for chunked upload handling.

status_id

Foreign key to statuses.id. Enforced by the storage layer.