ITpandaffm opened a new pull request, #7658:
URL: https://github.com/apache/opendal/pull/7658
## Which issue does this PR close?
Closes #7656.
## Rationale for this change
The OSS backend currently does not honor `OpWrite::content_encoding()`,
even
though the write option already exists and other object storage backends
such as
S3 and GCS support it.
Users who upload gzip/br/deflate objects to Aliyun OSS through OpenDAL
cannot
preserve the `Content-Encoding` metadata. This breaks CDN/browser
transparent
decompression for compressed static objects.
## What changes are included in this PR?
- `core/services/oss/src/backend.rs`
- Set `write_with_content_encoding: true` in the OSS capability table.
- `core/services/oss/src/core.rs`
- Import `http::header::CONTENT_ENCODING`.
- Forward `args.content_encoding()` in shared write metadata headers,
covering
`PutObject` and `AppendObject`.
- Add a `content_encoding` parameter to `oss_initiate_upload` and set the
header on `InitiateMultipartUpload`.
- `core/services/oss/src/writer.rs`
- Pass `self.op.content_encoding()` into `oss_initiate_upload` for
multipart
writes.
## Are there any user-facing changes?
Yes. OSS now advertises `write_with_content_encoding`, and
`op.write_with(...).content_encoding(...)` will preserve `Content-Encoding`
metadata on written objects.
Existing users who do not set `content_encoding` are unaffected.
## Tests
- `cargo fmt --check`
- `cargo check -p opendal --features services-oss --no-default-features`
- `cargo clippy -p opendal --features services-oss --no-default-features
-- -D warnings`
- `cargo test -p opendal-service-oss --no-default-features`
--
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]