You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "WangXiaoBao1222 (via GitHub)" <gi...@apache.org> on 2026/03/25 08:55:12 UTC
[I] bug: COS list response metadata cannot return ETag and LastModified [opendal]
WangXiaoBao1222 opened a new issue, #7306:
URL: https://github.com/apache/opendal/issues/7306
### Describe the bug
When running the following script, the etag information and last_madified return information of the file are incorrect
<img width="1914" height="786" alt="Image" src="https://github.com/user-attachments/assets/f86f7445-7cd6-4630-8420-29aca54e31b6" />
### Steps to Reproduce
Run this script based on OpenDAL 0.54.0 Python 3.10
[verify_cos_etag_last_modified.py](https://github.com/user-attachments/files/26236835/verify_cos_etag_last_modified.py)
### Expected Behavior
<img width="924" height="280" alt="Image" src="https://github.com/user-attachments/assets/6e1ac577-8b41-4daa-b742-724fd2d41f24" />
### Additional Context
opendal 0.54.0 python 3.10
### Are you willing to submit a PR to fix this bug?
- [x] Yes, I would like to submit a PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: COS list response metadata cannot return ETag and LastModified [opendal]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #7306:
URL: https://github.com/apache/opendal/issues/7306#issuecomment-4124870785
<!-- Greeting -->
Hi @WangXiaoBao1222! I'm [Dosu](https://go.dosu.dev/dosubot) and Iām helping the opendal team.
<!-- Answer -->
Thanks for reporting this! I can confirm this is a known bug in the COS service implementation.
**Root Cause**: The [`ListObjectsOutputContent` struct](https://github.com/apache/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/cos/core.rs#L629-L634) only extracts `key` and `size` from the XML response, missing `ETag` and `LastModified` fields:
```rust
pub struct ListObjectsOutputContent {
pub key: String,
pub size: u64,
// Missing: etag, last_modified
}
```
The XML response from COS does include these fields, but they're simply not being parsed.
**How to Fix**: You can follow the pattern already used by the [versioned lister](https://github.com/apache/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/cos/lister.rs#L199-L209) which correctly extracts these fields:
1. Add `last_modified: String` and `etag: Option<String>` fields to `ListObjectsOutputContent` in [`core/src/services/cos/core.rs`](https://github.com/apache/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/cos/core.rs#L629-L634)
2. Update the [standard lister](https://github.com/apache/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/cos/lister.rs#L87-L96) to set metadata from these fields, similar to how the versioned lister does it
Since you've indicated willingness to submit a PR, the versioned listing implementation provides a clear reference for the fix pattern.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).*
---
<sup>How did I do? [Good](https://app.dosu.dev/response-feedback/deb08e74-a676-41ca-9a39-43ac586a75f7?feedback_type=great_response&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/deb08e74-a676-41ca-9a39-43ac586a75f7?feedback_type=irrelevant_answer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/deb08e74-a676-41ca-9a39-43ac586a75f7?feedback_type=incorrect_sources&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/deb08e74-a676-41ca-9a39-43ac586a75f7?feedback_type=too_verbose&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/deb08e74-a676
-41ca-9a39-43ac586a75f7?feedback_type=hallucination&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination) | [Report š](https://app.dosu.dev/response-feedback/deb08e74-a676-41ca-9a39-43ac586a75f7?feedback_type=bug_report&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report) | [Other](https://app.dosu.dev/response-feedback/deb08e74-a676-41ca-9a39-43ac586a75f7?feedback_type=other&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other)</sup>
[](https://app.dosu.dev/997a2c5a-0c54-497b-989d-44651635dd36/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge) [](https://cursor.com/link/prompt?text=Thanks%20for%20reporting%20this%21%20I%20can%20confirm%20this%20is%20a%20known%20bug%20in%20the%20COS%20service%20implementation.%0A%0A%2A%2ARoot%20Cause%2A%2A%3A%20The%20%5B%60ListObjectsOutputContent%60%20struct%5D%28https%3A//github.com/apache/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/cos/core.rs%23L629-L634%29%20only%20extracts%20%60key%60%20and%20%60size%60%20from%20the%20XML%20response%2C%20missing%20%60ETag%60%20and%20%60LastModified%60%20fields%3A%0A%0A%60%60%60rust%0Apub%20struct%20ListObjectsOutputContent%20%7B%0A%20%20%20%20pub%20key%3A%20String%2C%0A%20%20%20%20pub%20size%3A%20u64%2C%0A%20%20%20%20//%20Missing%3A%20etag%2C%20last_mo
dified%0A%7D%0A%60%60%60%0A%0AThe%20XML%20response%20from%20COS%20does%20include%20these%20fields%2C%20but%20they%27re%20simply%20not%20being%20parsed.%0A%0A%2A%2AHow%20to%20Fix%2A%2A%3A%20You%20can%20follow%20the%20pattern%20already%20used%20by%20the%20%5Bversioned%20lister%5D%28https%3A//github.com/apache/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/cos/lister.rs%23L199-L209%29%20which%20correctly%20extracts%20these%20fields%3A%0A%0A1.%20Add%20%60last_modified%3A%20String%60%20and%20%60etag%3A%20Option%3CString%3E%60%20fields%20to%20%60ListObjectsOutputContent%60%20in%20%5B%60core/src/services/cos/core.rs%60%5D%28https%3A//github.com/apache/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/cos/core.rs%23L629-L634%29%0A%0A2.%20Update%20the%20%5Bstandard%20lister%5D%28https%3A//github.com/apache/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/cos/lister.rs%23L87-L96%29%20to%20set%20metadata%20from%20these%20fie
lds%2C%20similar%20to%20how%20the%20versioned%20lister%20does%20it%0A%0ASince%20you%27ve%20indicated%20willingness%20to%20submit%20a%20PR%2C%20the%20versioned%20listing%20implementation%20provides%20a%20clear%20reference%20for%20the%20fix%20pattern.) [](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/opendal/issues/7306)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: COS list response metadata cannot return ETag and LastModified [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo closed issue #7306: bug: COS list response metadata cannot return ETag and LastModified
URL: https://github.com/apache/opendal/issues/7306
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org