mirror of
https://github.com/rclone/rclone.git
synced 2025-01-13 20:38:12 +02:00
gcs: detect bucket presence by listing it - fixes #2193
Doing it like this enables the use of a service account that only has the "Storage Object Admin" role.
This commit is contained in:
parent
0358e9e724
commit
0cb5c4aa73
@ -608,7 +608,9 @@ func (f *Fs) Mkdir(dir string) error {
|
||||
if f.bucketOK {
|
||||
return nil
|
||||
}
|
||||
_, err := f.svc.Buckets.Get(f.bucket).Do()
|
||||
// List something from the bucket to see if it exists. Doing it like this enables the use of a
|
||||
// service account that only has the "Storage Object Admin" role. See #2193 for details.
|
||||
_, err := f.svc.Objects.List(f.bucket).MaxResults(1).Do()
|
||||
if err == nil {
|
||||
// Bucket already exists
|
||||
f.bucketOK = true
|
||||
|
Loading…
Reference in New Issue
Block a user