diff --git a/libs/remote_storage/src/azure_blob.rs b/libs/remote_storage/src/azure_blob.rs index 32c51bc2ad..9ae58c00c3 100644 --- a/libs/remote_storage/src/azure_blob.rs +++ b/libs/remote_storage/src/azure_blob.rs @@ -385,6 +385,7 @@ impl RemoteStorage for AzureBlobStorage { .map(|k| ListingObject{ key: self.name_to_relative_path(&k.name), last_modified: k.properties.last_modified.into(), + etag: k.properties.etag.clone(), size: k.properties.content_length, } ); @@ -450,6 +451,7 @@ impl RemoteStorage for AzureBlobStorage { Ok(ListingObject { key: key.to_owned(), last_modified: SystemTime::from(properties.last_modified), + etag: properties.etag, size: properties.content_length, }) } diff --git a/libs/remote_storage/src/lib.rs b/libs/remote_storage/src/lib.rs index 2a3468f986..278d451ac6 100644 --- a/libs/remote_storage/src/lib.rs +++ b/libs/remote_storage/src/lib.rs @@ -166,6 +166,7 @@ pub enum ListingMode { pub struct ListingObject { pub key: RemotePath, pub last_modified: SystemTime, + pub etag: Etag, pub size: u64, } diff --git a/libs/remote_storage/src/local_fs.rs b/libs/remote_storage/src/local_fs.rs index 1a2d421c66..dcc65ba6ab 100644 --- a/libs/remote_storage/src/local_fs.rs +++ b/libs/remote_storage/src/local_fs.rs @@ -372,6 +372,7 @@ impl RemoteStorage for LocalFs { objects.push(ListingObject { key: key.clone(), last_modified: metadata.modified()?, + etag: mock_etag(&metadata), size: metadata.len(), }); } @@ -414,6 +415,7 @@ impl RemoteStorage for LocalFs { result.keys.push(ListingObject { key: RemotePath::from_string(&relative_key).unwrap(), last_modified: object.last_modified, + etag: object.etag, size: object.size, }); } @@ -457,6 +459,7 @@ impl RemoteStorage for LocalFs { Ok(ListingObject { key: key.clone(), last_modified: metadata.modified()?, + etag: mock_etag(&metadata), size: metadata.len(), }) } diff --git a/libs/remote_storage/src/s3_bucket.rs b/libs/remote_storage/src/s3_bucket.rs index 2891f92d07..7a2b768ccb 100644 --- a/libs/remote_storage/src/s3_bucket.rs +++ b/libs/remote_storage/src/s3_bucket.rs @@ -588,11 +588,16 @@ impl RemoteStorage for S3Bucket { } }; + let etag = object.e_tag.clone() + .ok_or(DownloadError::Other(anyhow::anyhow!("Missing etag header")))? + .into(); + let size = object.size.unwrap_or(0) as u64; result.keys.push(ListingObject{ key, last_modified, + etag, size, }); if let Some(mut mk) = max_keys { @@ -690,11 +695,16 @@ impl RemoteStorage for S3Bucket { "head_object doesn't contain last_modified or content_length" )))?; }; + let etag = data + .e_tag + .ok_or(DownloadError::Other(anyhow::anyhow!("Missing etag header")))? + .into(); Ok(ListingObject { key: key.to_owned(), last_modified: SystemTime::try_from(last_modified).map_err(|e| { DownloadError::Other(anyhow!("can't convert time '{last_modified}': {e}")) })?, + etag: etag, size: size as u64, }) }