content_type -> mime_type

This commit is contained in:
2025-11-22 04:00:21 +01:00
parent 5871c7ae6e
commit 138e46a286
10 changed files with 34 additions and 28 deletions
+4 -4
View File
@@ -200,7 +200,7 @@ pub async fn upload_document(
let user_id = user_id;
let mut file_bytes: Option<Vec<u8>> = None;
let mut original_name: Option<String> = None;
let mut content_type: Option<String> = None;
let mut mime_type: Option<String> = None;
let mut folder_id: Option<Uuid> = None;
let mut metadata: Value = Value::Object(Default::default());
let mut tag_ids: Vec<Uuid> = Vec::new();
@@ -219,7 +219,7 @@ pub async fn upload_document(
Some("file") => {
let file_name = field.file_name().map(|n| n.to_string());
original_name = file_name.clone();
content_type = field.content_type().map(|mime| mime.to_string());
mime_type = field.content_type().map(|mime| mime.to_string());
let data = field.bytes().await.map_err(|err| {
let msg = format!("failed to read file bytes: {err}");
error!(error = %err, "failed to read file bytes");
@@ -348,7 +348,7 @@ pub async fn upload_document(
let request = DocumentUploadRequest {
bytes: file_bytes,
original_name,
content_type,
mime_type,
folder_id,
metadata,
title_override,
@@ -689,7 +689,7 @@ pub async fn download_with_token(
&version.s3_key,
disposition.as_deref(),
headers.get(header::RANGE).cloned(),
doc.content_type.as_deref(),
doc.mime_type.as_deref(),
Some(version.id.to_string()),
)
.await
+6 -6
View File
@@ -351,7 +351,7 @@ async fn stream_document(
if let Some(content_type) = upstream.headers().get(header::CONTENT_TYPE) {
builder = builder.header(header::CONTENT_TYPE, content_type);
} else if let Some(ref typ) = document.content_type {
} else if let Some(ref typ) = document.mime_type {
builder = builder.header(header::CONTENT_TYPE, typ);
}
@@ -529,7 +529,7 @@ fn build_resources_for_folder(
display_name,
is_collection: true,
content_length: None,
content_type: None,
mime_type: None,
last_modified,
});
@@ -545,7 +545,7 @@ fn build_resources_for_folder(
display_name: subfolder.name.clone(),
is_collection: true,
content_length: None,
content_type: None,
mime_type: None,
last_modified: Some(to_http_date(subfolder.updated_at)),
});
}
@@ -583,7 +583,7 @@ fn document_to_resource(
display_name: document.title.clone(),
is_collection: false,
content_length: Some(version.size_bytes),
content_type: document.content_type.clone(),
mime_type: document.mime_type.clone(),
last_modified: Some(to_http_date(document.updated_at)),
}
}
@@ -639,7 +639,7 @@ fn render_multistatus(resources: &[DavResource]) -> Result<Vec<u8>, quick_xml::E
writer.write_event(Event::End(BytesEnd::new("D:getcontentlength")))?;
}
if let Some(content_type) = &resource.content_type {
if let Some(content_type) = &resource.mime_type {
writer.write_event(Event::Start(BytesStart::new("D:getcontenttype")))?;
writer.write_event(Event::Text(BytesText::new(content_type)))?;
writer.write_event(Event::End(BytesEnd::new("D:getcontenttype")))?;
@@ -681,7 +681,7 @@ struct DavResource {
display_name: String,
is_collection: bool,
content_length: Option<i64>,
content_type: Option<String>,
mime_type: Option<String>,
last_modified: Option<String>,
}
enum ResolvedPath {