content_type -> mime_type
This commit is contained in:
@@ -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(|| {
|
||||
|
||||
@@ -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(|| {
|
||||
|
||||
@@ -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(|| {
|
||||
|
||||
Reference in New Issue
Block a user