Xuanwo opened a new pull request, #9307:
URL: https://github.com/apache/opendal/pull/9307

   # Which issue does this PR close?
   
   Relates to #6274.
   
   # Rationale for this change
   
   A caller could set `content_disposition` on a single-object B2 presigned 
upload, execute the returned POST successfully, and download a file with the 
requested bytes but no `Content-Disposition`. Even when a native B2 upload 
stored the property, OpenDAL's `Metadata::content_disposition()` returned 
`None`.
   
   # What changes are included in this PR?
   
   The B2 POST builder maps `content_disposition`, `content_encoding`, 
`content_language`, and `cache_control` to their reserved B2 file-info headers. 
`content_type` uses the native `Content-Type` header and defaults to 
`b2/x-auto`. The B2 service guide documents the precedence rule for these 
options.
   
   On live B2, we executed the returned POST unchanged with all five options, 
conflicting mixed-case metadata keys, and independent custom metadata. Native 
JSON and an exact-ID download confirmed the five properties, the custom 
metadata, and all 45 original bytes. A metadata-only upload and an upload with 
only similarly named custom keys verified the omission cases.
   
   # Are there any user-facing changes?
   
   For single-object presigned POST, a dedicated option takes precedence over a 
metadata key targeting the same native field, matched case-insensitively. 
Independent fields are retained. For example, custom `X-Bz-Info-Cache-Control` 
can coexist with B2's reserved cache policy.
   
   Current and versioned `stat` and `list` now expose the stored 
`Content-Disposition`. They use the B2 JSON value directly so a literal `%20` 
in a filename survives readback. `user_metadata()` retains its existing 
decoding behavior. The live encoding and language checks covered native JSON 
and download response headers.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Pi, `magpie/codex/gpt-6.2-sol`, `max`: reproduced the issue, implemented 
the change, and verified it against native B2.
   - Pi, `magpie/agy-cli/gemini-4-neon`, `high`: drafted the title and 
description.
   - Pi, `magpie/devin/swe-2-1`, provider default: independently reviewed 
request construction, metadata parsing, and the live B2 receipts.
   - Pi, `magpie/codex/gpt-6.2-astra`, `high`: coordinated the work and edited 
the description.
   


-- 
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]

Reply via email to