Filter by mime
This commit is contained in:
@@ -9,7 +9,7 @@ use std::{
|
||||
use tracing::trace;
|
||||
|
||||
use crate::{
|
||||
extract::traits::ObjectExtractor,
|
||||
extract::traits::{ExtractState, ObjectExtractor},
|
||||
value::{Item, PileValue, SyncReadBridge},
|
||||
};
|
||||
|
||||
@@ -104,6 +104,7 @@ impl PdfTextExtractor {
|
||||
impl ObjectExtractor for PdfTextExtractor {
|
||||
async fn field(
|
||||
&self,
|
||||
state: &ExtractState,
|
||||
name: &Label,
|
||||
args: Option<&str>,
|
||||
) -> Result<Option<PileValue>, std::io::Error> {
|
||||
@@ -111,6 +112,10 @@ impl ObjectExtractor for PdfTextExtractor {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
if !state.ignore_mime && self.item.mime().essence_str() != "application/pdf" {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
Ok(self.get_inner().await?.get(name).cloned())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user