This is an automated email from the ASF dual-hosted git repository.

Xuanwo pushed a commit to branch xuanwo/publish-gcs-presigned-disposition
in repository https://gitbox.apache.org/repos/asf/opendal.git

commit 95f219017b7b5fc627e225125cd052d08fb05280
Author: Xuanwo <[email protected]>
AuthorDate: Fri Nov 27 16:56:33 2026 +0100

    fix(services/gcs): preserve content disposition in presigned writes
---
 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]

Reply via email to