[pbs-devel] [PATCH proxmox] s3-client: make truncation flag optional in list object v2 response
Christian Ebner
c.ebner at proxmox.com
Wed Jan 7 13:07:57 CET 2026
Some providers do not return the `IsTruncated` flag [0] in the
response body for list object v2 API calls, signaling that there are
further object keys to be returned by subsequent API calls providing
the next continuation token.
Since this flag is optional, allow it to be missing for XML response
body parsing and default for it to be false in the client response.
Other unused members for the struct used for XML parsing have already
been dropped in commit eb559d87 ("fix #7008: s3-client: drop unused
optional object list v2 response fields").
Fixes: https://forum.proxmox.com/threads/178707/
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
proxmox-s3-client/src/response_reader.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/proxmox-s3-client/src/response_reader.rs b/proxmox-s3-client/src/response_reader.rs
index 47fcd129..e03b3bb0 100644
--- a/proxmox-s3-client/src/response_reader.rs
+++ b/proxmox-s3-client/src/response_reader.rs
@@ -37,7 +37,7 @@ pub struct ListObjectsV2Response {
/// https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html#API_ListObjectsV2_ResponseSyntax
struct ListObjectsV2ResponseBody {
/// Flag indication if response was truncated because of key limits.
- pub is_truncated: bool,
+ pub is_truncated: Option<bool>,
/// Token used for this request to get further keys in truncated responses.
pub continuation_token: Option<String>,
/// Allows to fetch the next set of keys for truncated responses.
@@ -50,7 +50,7 @@ impl ListObjectsV2ResponseBody {
fn with_optional_date(self, date: Option<HttpDate>) -> ListObjectsV2Response {
ListObjectsV2Response {
date,
- is_truncated: self.is_truncated,
+ is_truncated: self.is_truncated.unwrap_or_default(),
continuation_token: self.continuation_token,
next_continuation_token: self.next_continuation_token,
contents: self.contents.unwrap_or_default(),
@@ -530,7 +530,7 @@ fn parse_list_objects_v2_response_test() {
</ListBucketResult>
"#;
let result: ListObjectsV2ResponseBody = serde_xml_rs::from_str(response_body).unwrap();
- assert!(!result.is_truncated);
+ assert_eq!(result.is_truncated, Some(false));
assert_eq!(
result.contents.unwrap(),
vec![
--
2.47.3
More information about the pbs-devel
mailing list