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.
Did it definitely set the wrong header on upload or did the blobref itself come back with the wrong mime type? Because the PDS itself does inference on mime types and has in fact returned a blob ref with a different mime type than i asserted on upload before (not with jacquard, this was when i was doing stuff in Kotlin).