Skip to content

Commit

Permalink
modify ListOpResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
zjregee committed Mar 3, 2024
1 parent a416304 commit 13120b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions core/src/services/swift/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ pub enum ListOpResponse {
bytes: u64,
hash: String,
name: String,
content_type: String,
last_modified: String,
content_type: Option<String>,
},
}

Expand Down Expand Up @@ -270,10 +270,10 @@ mod tests {
bytes: 147,
hash: "5e6b5b70b0426b1cc1968003e1afa5ad".to_string(),
name: "test.txt".to_string(),
content_type:
"multipart/form-data;boundary=------------------------25004a866ee9c0cb"
.to_string(),
last_modified: "2023-11-01T03:00:23.147480".to_string(),
content_type:
Some("multipart/form-data;boundary=------------------------25004a866ee9c0cb"
.to_string()),
}
);

Expand Down
9 changes: 7 additions & 2 deletions core/src/services/swift/lister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,14 @@ impl oio::PageList for SwiftLister {
meta.set_content_md5(hash.as_str());

// we'll change "2023-10-28T19:18:11.682610" to "2023-10-28T19:18:11.682610Z"
last_modified.push('Z');
if !last_modified.ends_with('Z') {
last_modified.push('Z');
}
meta.set_last_modified(parse_datetime_from_rfc3339(last_modified.as_str())?);
meta.set_content_type(content_type.as_str());

if let Some(content_type) = content_type {
meta.set_content_type(content_type.as_str());
}

oio::Entry::with(name, meta)
}
Expand Down

0 comments on commit 13120b5

Please sign in to comment.