Xuanwo opened a new pull request, #9294:
URL: https://github.com/apache/opendal/pull/9294
# Which issue does this PR close?
Refs #6274.
# Rationale for this change
GCS presigned writes use the XML API single-object PUT request. Previously,
`GcsCore::gcs_insert_object_xml_request` did not forward
`OpWrite::content_disposition()`, so `Operator::presign_write_options` omitted
`Content-Disposition` from both the returned `PresignedRequest` headers and
`X-Goog-SignedHeaders`.
When reproduced against real GCS with an RSA V4 service-account credential,
sending that presigned PUT unchanged with an 83-byte payload returned HTTP 200,
while independent generation-pinned JSON metadata and media GETs confirmed the
exact bytes were stored with `contentDisposition` missing.
# What changes are included in this PR?
- Forward `OpWrite::content_disposition()` as the `Content-Disposition`
header in `GcsCore::gcs_insert_object_xml_request`
(`core/services/gcs/src/core.rs`) before V4 query signing, alongside the
existing `Content-Type`, `Content-Encoding`, `Cache-Control`, and
`x-goog-meta-*` headers.
- Update the XML request unit test in `core/services/gcs/src/core.rs`
(`test_gcs_insert_object_xml_request_with_cache_control_and_content_disposition`)
to assert both `Cache-Control` and `Content-Disposition` on the constructed
XML PUT request.
## Verification
- **Automated unit regression (final commit):**
`core::tests::test_gcs_insert_object_xml_request_with_cache_control_and_content_disposition`
covers XML PUT request construction for `Cache-Control` and
`Content-Disposition` in `core/services/gcs/src/core.rs` (failed on the parent
commit with `no entry found for key "content-disposition"`, passes on this
commit). Continuous automated coverage ends at XML request construction and
does not exercise live V4 signing or GCS persistence.
- **Recorded live GCS verification (byte-identical runtime code):** Verified
against real GCS using an RSA V4 service-account fixture (`reqsign-google`
3.4.0) with a create-only guard (`x-goog-if-generation-match: 0`) on a revision
whose runtime code in `core/services/gcs/src/core.rs` matches this commit byte
for byte:
- `Operator::presign_write_options` returned `Content-Disposition:
attachment; filename="opendal-6274.txt"` once and included
`content-disposition` in `X-Goog-SignedHeaders`.
- Sending the returned method, URI, and headers unchanged with an 83-byte
payload returned HTTP 200 and an `x-goog-generation` receipt.
- Independent JSON metadata and media GETs pinned to that exact generation
returned HTTP 200 and confirmed the stored `contentDisposition`, generation,
size, MD5, and exact 83 payload bytes.
- Cleanup deleted the live generation with a generation-matched JSON
DELETE (HTTP 204); the bucket retained one soft-deleted generation under its
seven-day retention policy.
# Are there any user-facing changes?
Yes. `Operator::presign_write_options` on GCS now forwards
`WriteOptions::content_disposition` as a signed `Content-Disposition` header on
the generated XML PUT request so uploads executed with the presigned request
persist `contentDisposition` on GCS. Ordinary GCS JSON write capabilities and
behavior are unchanged (`write_with_content_disposition` remains `false`); no
claim is made for ordinary JSON writes.
# Breaking changes
# AI Usage Statement
- **Harness:** Pi
- **Model:** `magpie/codex/gpt-6.2-sol`
- **Effort:** `max`
- **Role:** Reproduced the baseline failure, implemented XML PUT header
forwarding and the unit regression, and verified the fix through the public API
and generation-pinned readback on GCS.
- **Harness:** Pi
- **Model:** `magpie/codex/gpt-6.2-sol`
- **Effort:** `high`
- **Role:** Performed independent review of the implementation and
verification evidence.
- **Harness:** Pi
- **Model:** `magpie/codex/gpt-6.2-astra`
- **Effort:** `high`
- **Role:** Coordinated the task and made the test-coverage decision.
- **Harness:** Pi
- **Model:** `magpie/agy-cli/gemini-4-neon` (Gemini 4 Neon)
- **Effort:** `high`
- **Role:** Drafted and updated this PR body from the repository template
and recorded verification evidence, rechecked publication preflight, and
published the PR.
Assumptions and unknowns affecting review:
- Live verification exercised RSA V4 service-account query signing against a
real GCS bucket on byte-identical runtime code and does not establish behavior
across other GCS authentication modes or ordinary GCS JSON writes.
- Continuous automated regression coverage checks XML PUT request
construction only
(`test_gcs_insert_object_xml_request_with_cache_control_and_content_disposition`);
live V4 signing and GCS persistence come from the recorded real-GCS trial.
--
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]