Skip to content

Commit

Permalink
fix: format_object_meta should not require metakeys that don't exist (#…
Browse files Browse the repository at this point in the history
…4582)

format_object_meta should not require metakeys that don't exist
  • Loading branch information
rebasedming authored May 7, 2024
1 parent 9d587ea commit 79ab57f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions integrations/object_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,22 @@ fn format_object_store_error(err: opendal::Error, path: &str) -> object_store::E
}

fn format_object_meta(path: &str, meta: &Metadata) -> ObjectMeta {
let version = match meta.metakey().contains(Metakey::Version) {
true => meta.version().map(|x| x.to_string()),
false => None,
};

let e_tag = match meta.metakey().contains(Metakey::Etag) {
true => meta.etag().map(|x| x.to_string()),
false => None,
};

ObjectMeta {
location: path.into(),
last_modified: meta.last_modified().unwrap_or_default(),
size: meta.content_length() as usize,
e_tag: meta.etag().map(|x| x.to_string()),
version: meta.version().map(|x| x.to_string()),
e_tag,
version,
}
}

Expand Down

0 comments on commit 79ab57f

Please sign in to comment.