You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It turns out that the XML API predefined ACLs uses kebab casing instead of camel casing, and thus publicRead should be converted to public-read when signing urls etc.
Here is a simple program that reproduces the problem
use std::time::Duration;use opendal::{services::Gcs,Operator};#[tokio::main]asyncfnmain(){let bucket = todo!("Enter your own bucket name");let gcs_no_acl = Operator::new(Gcs::default().bucket(&bucket)).unwrap().finish();let gcs_has_acl = Operator::new(Gcs::default().bucket(&bucket).predefined_acl("publicRead")).unwrap().finish();let client = reqwest::Client::new();{let presign = gcs_no_acl.presign_write("file_no_acl",Duration::from_secs(3600)).await.unwrap();let res = client.put(presign.uri().to_string()).headers(presign.header().clone()).body("Hello, world").send().await.unwrap();let status = res.status();assert!(status.is_success());// Works, and file_no_acl is present }{let presign = gcs_has_acl.presign_write("file_has_acl",Duration::from_secs(3600)).await.unwrap();let res = client.put(presign.uri().to_string()).headers(presign.header().clone()).body("Hello, world").send().await.unwrap();let status = res.status();let response_text = res.text().await.unwrap();println!("{response_text}");// TL;DR: Invalid canned acl: publicReadassert!(status.is_success());// FAILS}}
Expected Behavior
Both asserts should pass, and my bucket should have both file_no_acl and file_has_acl after running the program. Additionally, file_has_acl should have publicRead ACL set.
Additional Context
No response
Are you willing to submit a PR to fix this bug?
Yes, I would like to submit a PR.
The text was updated successfully, but these errors were encountered:
Describe the bug
Gcs
does not handlepredefinedAcl
incorrectly when usingpresign
. Trying to use the resulting URL will result in an error like thisIt turns out that the XML API predefined ACLs uses kebab casing instead of camel casing, and thus
publicRead
should be converted topublic-read
when signing urls etc.Here's the relevant documentation:
https://cloud.google.com/storage/docs/access-control/lists#predefined-acl
Steps to Reproduce
Here is a simple program that reproduces the problem
Expected Behavior
Both asserts should pass, and my bucket should have both
file_no_acl
andfile_has_acl
after running the program. Additionally,file_has_acl
should havepublicRead
ACL set.Additional Context
No response
Are you willing to submit a PR to fix this bug?
The text was updated successfully, but these errors were encountered: