This is an automated email from the ASF dual-hosted git repository.
crepererum pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs-object-store.git
The following commit(s) were added to refs/heads/main by this push:
new 706b7d8 fix(core): add missing version assignment (#691)
706b7d8 is described below
commit 706b7d8b536fd02a8a323bb8dbeae344fc8d65eb
Author: dentiny <[email protected]>
AuthorDate: Thu May 7 02:32:59 2026 -0700
fix(core): add missing version assignment (#691)
---
src/prefix.rs | 43 ++++++++++++++++++++++++++++++++++++++-----
1 file changed, 38 insertions(+), 5 deletions(-)
diff --git a/src/prefix.rs b/src/prefix.rs
index 9cdf3b0..b6e9137 100644
--- a/src/prefix.rs
+++ b/src/prefix.rs
@@ -84,12 +84,19 @@ fn strip_prefix(prefix: &Path, path: Path) -> Path {
/// Strip the constant prefix from a given ObjectMeta
fn strip_meta(prefix: &Path, meta: ObjectMeta) -> ObjectMeta {
+ let ObjectMeta {
+ last_modified,
+ size,
+ location,
+ e_tag,
+ version,
+ } = meta;
ObjectMeta {
- last_modified: meta.last_modified,
- size: meta.size,
- location: strip_prefix(prefix, meta.location),
- e_tag: meta.e_tag,
- version: None,
+ last_modified,
+ size,
+ location: strip_prefix(prefix, location),
+ e_tag,
+ version,
}
}
@@ -321,6 +328,32 @@ mod tests {
store.get(&head.location).await.unwrap();
}
+ #[test]
+ fn strip_meta_preserves_version_and_etag() {
+ let prefix = Path::from("prefix");
+ let meta = ObjectMeta {
+ location: Path::from("prefix/foo"),
+ last_modified: chrono::DateTime::from_timestamp(1_700_000_000,
0).unwrap(),
+ size: 42,
+ e_tag: Some("etag-value".to_string()),
+ version: Some("version-value".to_string()),
+ };
+
+ let ObjectMeta {
+ location,
+ last_modified,
+ size,
+ e_tag,
+ version,
+ } = strip_meta(&prefix, meta.clone());
+
+ assert_eq!(location, Path::from("foo"));
+ assert_eq!(last_modified, meta.last_modified);
+ assert_eq!(size, meta.size);
+ assert_eq!(e_tag, meta.e_tag);
+ assert_eq!(version, meta.version);
+ }
+
#[tokio::test]
async fn prefix_multipart() {
let store = PrefixStore::new(InMemory::new(), "prefix");