Skip to main content

object_get_text

Function object_get_text 

Source
pub async fn object_get_text(
    profile_id: ProfileId,
    bucket: String,
    key: String,
    max_bytes: Option<u64>,
    store: State<'_, ProfileStoreHandle>,
    pool: State<'_, S3ClientPoolHandle>,
) -> Result<TextPayload, AppError>
Expand description

Fetch the first max_bytes bytes of an S3 object as UTF-8 text.

Uses a Range: bytes=0-<max_bytes-1> request so large objects are not fully downloaded. Invalid UTF-8 bytes are replaced with U+FFFD.

Returns a TextPayload with the decoded body, total content length, ETag, and a truncated flag. The default limit is 1 MiB when max_bytes is omitted.

This command is intentionally read-only and does not emit any events or touch the mutation cache. It is reusable by the Monaco editor (task 50) for its initial content load.

ยงValidation gate

Refuses to serve data when the profile has not been validated (AC-8 / round-1 finding #9).