Private
Public Access
1
0

Merge branch 'wip/attachment_mime'

* wip/attachment_mime:
  core: attachment store: limit concurrent downloads
  core: attachment mime: prefer jpg instead of jfif
  wip: attachment MIME
This commit is contained in:
2025-09-10 14:41:36 -07:00
5 changed files with 251 additions and 19 deletions

View File

@@ -625,6 +625,27 @@ impl<K: AuthenticationStore + Send + Sync> HTTPAPIClient<K> {
Ok(response)
}
// Fetch an attachment while preserving response headers (e.g., Content-Type).
// Returns the streaming body and the Content-Type header if present.
pub async fn fetch_attachment_with_metadata(
&mut self,
guid: &str,
preview: bool,
) -> Result<(ResponseStream, Option<String>), Error> {
let endpoint = format!("attachment?guid={}&preview={}", guid, preview);
let response = self
.response_with_body_retry(&endpoint, Method::GET, Body::empty, true)
.await?;
let content_type = response
.headers()
.get(hyper::header::CONTENT_TYPE)
.and_then(|v| v.to_str().ok())
.map(|s| s.to_string());
Ok((ResponseStream::from(response.into_body()), content_type))
}
}
#[cfg(test)]