This is an automated email from the ASF dual-hosted git repository.
Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new f570e8204d fix(services/gcs): preserve content disposition in
presigned writes (#9294)
f570e8204d is described below
commit f570e8204d6a697b30773b2b46a0eecee6d0a7fa
Author: Xuanwo <[email protected]>
AuthorDate: Sat Nov 28 00:27:00 2026 +0800
fix(services/gcs): preserve content disposition in presigned writes (#9294)
---
core/services/gcs/src/core.rs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/core/services/gcs/src/core.rs b/core/services/gcs/src/core.rs
index 4a14340ea8..29396c7786 100644
--- a/core/services/gcs/src/core.rs
+++ b/core/services/gcs/src/core.rs
@@ -565,6 +565,10 @@ impl GcsCore {
req = req.header(CONTENT_TYPE, content_type);
}
+ if let Some(content_disposition) = args.content_disposition() {
+ req = req.header(CONTENT_DISPOSITION, content_disposition);
+ }
+
if let Some(content_encoding) = args.content_encoding() {
req = req.header(CONTENT_ENCODING, content_encoding);
}
@@ -2077,12 +2081,14 @@ mod tests {
}
#[test]
- fn test_gcs_insert_object_xml_request_with_cache_control() {
+ fn
test_gcs_insert_object_xml_request_with_cache_control_and_content_disposition()
{
+ let content_disposition = "attachment; filename=\"greeting.txt\"";
let request = test_core()
.gcs_insert_object_xml_request(
"object",
&write_args(options::WriteOptions {
cache_control: Some("private, max-age=137".to_owned()),
+ content_disposition: Some(content_disposition.to_owned()),
..Default::default()
}),
Buffer::new(),
@@ -2090,6 +2096,7 @@ mod tests {
.expect("request must build");
assert_eq!(request.headers()[CACHE_CONTROL], "private, max-age=137");
+ assert_eq!(request.headers()[CONTENT_DISPOSITION],
content_disposition);
}
#[test]