Skip to main content

object_get_bytes

Function object_get_bytes 

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

Fetch the first max_bytes bytes of an S3 object as a base64-encoded string.

Uses a Range: bytes=0-<max_bytes-1> request so large objects are not fully downloaded. The frontend decodes with atob or equivalent.

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

ยงValidation gate

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