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