blob mimeType is hardcoded to be \*/\*

did:plc:ttdrpj45ibqunmfhdsb4zdwq opened this Nov 2, 2025 3 comments
did:plc:ttdrpj45ibqunmfhdsb4zdwq opened Nov 2, 2025

for some reason I can't make a fork to issue a fix

issue:

uploadBlob would ignore a set MimeType and set it as */* when sent to the PDS

repro:

let blob = agent.upload_blob(
        base64_bytes,
        MimeType::new_static("application/octet-stream"),
    ).await?;

output of this code:

json: {
  "blob": {
    "$type": "blob",
    "mimeType": "*/*",
    "ref": {
      "$link": "bafkreiayayykxokf4ml44crf3ez62xyjurt4mashy74bravrgrl52yphvu"
    },
    "size": 46828
  }
}

fix:

in jacquard/crates/jacquard-common/src/xrpc.rs

       551
       552 +      // Check if extra_headers already contains Content-Type
       553 +      let has_content_type = opts.extra_headers.iter().any(|(name, _)| name == CONTENT_TYPE);
       554 +
       555        if let XrpcMethod::Procedure(encoding) = <R as XrpcRequest>::METHOD {
       556 -          builder = builder.header(Header::ContentType, encoding);
       556 +          // Only set default Content-Type if not provided in extra_headers
       557 +          if !has_content_type {
       558 +              builder = builder.header(Header::ContentType, encoding);
       559 +          }

theres probably a better way of doing this, i did this at 1am tired.

No activity yet.

cospan · schematic version control on atproto built on AT Protocol