You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2025/02/25 04:21:36 UTC

(opendal) branch fix-gcs-cache-control created (now 2f14a193d)

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

xuanwo pushed a change to branch fix-gcs-cache-control
in repository https://gitbox.apache.org/repos/asf/opendal.git


      at 2f14a193d fix(services/gcs): Fix cache control not present in object meta

This branch includes the following new commits:

     new 2f14a193d fix(services/gcs): Fix cache control not present in object meta

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(opendal) 01/01: fix(services/gcs): Fix cache control not present in object meta

Posted by xu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch fix-gcs-cache-control
in repository https://gitbox.apache.org/repos/asf/opendal.git

commit 2f14a193d02f1bea985b60cf6043a3ba8063688e
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Tue Feb 25 12:21:05 2025 +0800

    fix(services/gcs): Fix cache control not present in object meta
    
    Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
 core/src/services/gcs/backend.rs | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/core/src/services/gcs/backend.rs b/core/src/services/gcs/backend.rs
index fa2c0156d..9dbeaa541 100644
--- a/core/src/services/gcs/backend.rs
+++ b/core/src/services/gcs/backend.rs
@@ -448,6 +448,10 @@ impl Access for GcsBackend {
             m.set_content_encoding(&meta.content_encoding);
         }
 
+        if !meta.cache_control.is_empty() {
+            m.set_cache_control(&meta.cache_control);
+        }
+
         m.set_last_modified(parse_datetime_from_rfc3339(&meta.updated)?);
 
         if !meta.metadata.is_empty() {
@@ -564,6 +568,8 @@ struct GetObjectJsonResponse {
     ///
     /// For example: "contentEncoding": "br"
     content_encoding: String,
+    /// Cache-Control directive for the object data.
+    cache_control: String,
     /// Custom metadata of this object.
     ///
     /// For example: `"metadata" : { "my-key": "my-value" }`
@@ -587,6 +593,7 @@ mod tests {
   "metageneration": "1",
   "contentType": "image/png",
   "contentEncoding": "br",
+  "cacheControl": "public, max-age=3600",
   "storageClass": "STANDARD",
   "size": "56535",
   "md5Hash": "fHcEH1vPwA6eTPqxuasXcg==",
@@ -609,6 +616,7 @@ mod tests {
         assert_eq!(meta.etag, "CKWasoTgyPkCEAE=");
         assert_eq!(meta.content_type, "image/png");
         assert_eq!(meta.content_encoding, "br".to_string());
+        assert_eq!(meta.cache_control, "public, max-age=3600".to_string());
         assert_eq!(
             meta.metadata,
             HashMap::from_iter([("location".to_string(), "everywhere".to_string())])