Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions core/src/services/s3/pager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ impl oio::Page for S3Pager {

let mut meta = Metadata::new(EntryMode::FILE);

meta.set_etag(&object.etag);
meta.set_content_md5(object.etag.trim_matches('"'));
if let Some(etag) = &object.etag {
meta.set_etag(etag);
meta.set_content_md5(etag.trim_matches('"'));
}
meta.set_content_length(object.size);

// object.last_modified provides more precious time that contains
Expand Down Expand Up @@ -168,7 +170,7 @@ struct OutputContent {
size: u64,
last_modified: String,
#[serde(rename = "ETag")]
etag: String,
etag: Option<String>,
}

#[derive(Default, Debug, Eq, PartialEq, Deserialize)]
Expand Down Expand Up @@ -205,6 +207,11 @@ mod tests {
<Size>100</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>photos/2008</Key>
<LastModified>2016-05-30T23:51:29.000Z</LastModified>
<Size>42</Size>
</Contents>

<CommonPrefixes>
<Prefix>photos/2006/February/</Prefix>
Expand Down Expand Up @@ -232,15 +239,21 @@ mod tests {
OutputContent {
key: "photos/2006".to_string(),
size: 56,
etag: "\"d41d8cd98f00b204e9800998ecf8427e\"".to_string(),
etag: Some("\"d41d8cd98f00b204e9800998ecf8427e\"".to_string()),
last_modified: "2016-04-30T23:51:29.000Z".to_string(),
},
OutputContent {
key: "photos/2007".to_string(),
size: 100,
last_modified: "2016-04-30T23:51:29.000Z".to_string(),
etag: "\"d41d8cd98f00b204e9800998ecf8427e\"".to_string(),
}
etag: Some("\"d41d8cd98f00b204e9800998ecf8427e\"".to_string()),
},
OutputContent {
key: "photos/2008".to_string(),
size: 42,
last_modified: "2016-05-30T23:51:29.000Z".to_string(),
etag: None,
},
]
)
}
Expand Down