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
+3 -3
View File
@@ -155,8 +155,8 @@ pub(crate) fn determine_thumbnail_support(document: &Document) -> (bool, Option<
.into_iter()
.collect();
if let Some(ref content_type) = document.content_type {
if supported_mimes.contains(content_type.as_str()) {
if let Some(ref mime_type) = document.mime_type {
if supported_mimes.contains(mime_type.as_str()) {
return (true, None);
}
}
@@ -183,7 +183,7 @@ pub(crate) fn determine_thumbnail_support(document: &Document) -> (bool, Option<
fn document_supports_ocr(document: &Document) -> bool {
document
.content_type
.mime_type
.as_deref()
.map(|mime| mime.eq_ignore_ascii_case("application/pdf"))
.unwrap_or_else(|| {
+5 -5
View File
@@ -59,7 +59,7 @@ impl Task<DocumentVersionTaskContext> for GenerateOcrTask {
let bytes = ctx.buffered_object().await?.to_vec();
let meta = PdfDocumentMeta {
content_type: context.document.content_type.clone(),
mime_type: context.document.mime_type.clone(),
original_name: context.document.original_name.clone(),
};
@@ -284,7 +284,7 @@ fn generate_ocr_text(meta: &PdfDocumentMeta, bytes: &[u8]) -> Option<OcrGenerati
}
struct PdfDocumentMeta {
content_type: Option<String>,
mime_type: Option<String>,
original_name: String,
}
@@ -395,8 +395,8 @@ fn run_ocr(bytes: &[u8]) -> Result<Option<String>, OcrError> {
}
fn document_meta_is_pdf(meta: &PdfDocumentMeta) -> bool {
if let Some(content_type) = &meta.content_type {
if content_type.eq_ignore_ascii_case("application/pdf") {
if let Some(mime_type) = &meta.mime_type {
if mime_type.eq_ignore_ascii_case("application/pdf") {
return true;
}
}
@@ -410,7 +410,7 @@ fn document_meta_is_pdf(meta: &PdfDocumentMeta) -> bool {
fn document_is_pdf(document: &Document) -> bool {
document
.content_type
.mime_type
.as_deref()
.map(|mime| mime.eq_ignore_ascii_case("application/pdf"))
.unwrap_or_else(|| {
+1 -1
View File
@@ -463,7 +463,7 @@ fn persist_document_page_count(
fn document_is_pdf(document: &Document) -> bool {
document
.content_type
.mime_type
.as_deref()
.map(|mime| mime.eq_ignore_ascii_case("application/pdf"))
.unwrap_or_else(|| {