chitralverma opened a new issue, #8952: URL: https://github.com/apache/opendal/issues/8952
### OpenDAL version or commit main (495874912) ### Affected service or component services/gcs ### Describe the bug `GcsReader` reports the `ETag` response header verbatim, while `stat` and `list` report the JSON API `etag` field. Real GCS sends both in the same unquoted form. fake-gcs-server quotes the media download `ETag` header, so there the same object yields `"abc=="` from read and `abc==` from stat. `CacheLayer` digests the etag into the object identity, so when the two forms differ, a `stat` between two cached reads looks like a changed object and the cached chunks are no longer used. ### Steps to Reproduce Against fake-gcs-server 1.52.2 or 1.56.1, with any object: ```rust let stat = op.stat(path).await?; let reader = op.reader(path).await?; reader.read(0..16).await?; assert_eq!(stat.etag(), reader.metadata().unwrap().etag()); let cached = op.clone().layer(CacheLayer::new(Operator::new(Memory::default())?)?); cached.read_with(path).range(0..65536).await?; cached.stat(path).await?; cached.read_with(path).range(0..65536).await?; ``` ### Actual Behavior The assertion fails (`abc==` vs `"abc=="`), and the second cached read makes one origin GET. ### Expected Behavior Stat, list and read report one etag form, and the second cached read makes no origin request. GCS only matches the unquoted form in `If-Match` / `If-None-Match` on the JSON API (a quoted value gets 412 / 200 instead of 200 / 304), so the unquoted form is the one to report. ### Additional Context Checked with `curl` against public objects in `gcp-public-data-landsat` and `gcp-public-data-sentinel-2`: the JSON `etag` field and the `alt=media` `ETag` header are both unquoted, e.g. `CPuDloKbldYCEAE=`. fake-gcs-server writes the header with Go's `%q` in `downloadObject`. ### 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
