Filter by mime

This commit is contained in:
2026-03-15 10:20:15 -07:00
parent 8041fc7531
commit 979fbb9b0d
30 changed files with 258 additions and 93 deletions

View File

@@ -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())
}