-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gcs_save_all does not allow setting predefined_acl #129
Comments
Thanks, uniform buckets are the norm now but object level ACL was legacy - this function did not get updated when the others did as well which was an oversight so will add an option to specify the ACL or use uniform bucket ACL. |
A workaround for now is to look at the function and modify it which is what the fix will be: gcs_save_all <- function(directory = getwd(),
bucket = gcs_get_global_bucket(),
pattern = ""){
tmp <- tempfile(fileext = ".zip")
on.exit(unlink(tmp))
bucket <- as.bucket_name(bucket)
the_files <- list.files(path = directory,
all.files = TRUE,
recursive = TRUE,
pattern = pattern)
withCallingHandlers(
zip::zip(tmp, files = the_files),
deprecated = function(e) NULL)
gcs_upload(tmp, bucket = bucket, name = directory, predefinedAcl = "bucketLevel")
} |
That should be fixed now, you can pass in the predefinedACl in googleCloudStorageR::gcs_save_all(
directory = 'path-to-all-images',
bucket = 'my-bucket',
predefinedAcl = "bucketLevel"
) Use the GitHub version to use it e.g. install via |
Thank you! |
It appears that the gcs_save_all() function defaults to setting a predefinedAcl of "private" when uploading, and it provides no option to override this setting.
For buckets with uniform bucket-level access enabled, "private" is not a valid predefinedAcl setting, and so there is no way to legally use gcs_save_all for such buckets, as a user noticed on Stack Overflow: https://stackoverflow.com/questions/64164389/uploading-png-images-to-gcs-in-r-can-upload-individually-but-cannot-upload-en
Solutions include changing the default behavior to not specifying an ACL or allowing the customer to override the default behavior.
The text was updated successfully, but these errors were encountered: