diff --git a/core/src/services/s3/pager.rs b/core/src/services/s3/pager.rs index 3c5b15ed033..1525aa4ab49 100644 --- a/core/src/services/s3/pager.rs +++ b/core/src/services/s3/pager.rs @@ -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 @@ -168,7 +170,7 @@ struct OutputContent { size: u64, last_modified: String, #[serde(rename = "ETag")] - etag: String, + etag: Option, } #[derive(Default, Debug, Eq, PartialEq, Deserialize)] @@ -205,6 +207,11 @@ mod tests { 100 STANDARD + + photos/2008 + 2016-05-30T23:51:29.000Z + 42 + photos/2006/February/ @@ -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, + }, ] ) }