Files
Max Isbey a7a9ab58b7 Replace FileResource.is_binary with an encoding field
FileResource guessed is_binary from mime_type with a text/* prefix check,
and because False doubled as the "not given" sentinel an explicit
is_binary=False could never take effect, so application/json files were
always served as base64 blobs. Text reads also used Path.read_text()
with no encoding, i.e. the platform locale.

The field is now encoding: str | None. A string decodes the file and
serves it as text; None reads bytes and serves a blob. When omitted the
default comes from mime_type: the declared charset if present, else
utf-8 for textual types (text/*, +json/+xml suffixes, application/json,
xml, javascript), else None.

Resource models now reject unknown keyword arguments, so passing the
removed is_binary= fails at construction instead of being ignored.
2026-07-25 19:32:11 +00:00
..