Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

gcs: Check for errors when testing bucket is OK in mkdir #1590

Nick Craig-Wood76c5aa853360
diff --git a/googlecloudstorage/googlecloudstorage.go b/googlecloudstorage/googlecloudstorage.go
index 40ceaf670..8285dcf9d 100644
--- a/googlecloudstorage/googlecloudstorage.go
+++ b/googlecloudstorage/googlecloudstorage.go
@@ -578,6 +578,12 @@ func (f *Fs) Mkdir(dir string) error {
// Bucket already exists
f.bucketOK = true
return nil
+ } else if gErr, ok := err.(*googleapi.Error); ok {
+ if gErr.Code != http.StatusNotFound {
+ return errors.Wrap(err, "failed to get bucket")
+ }
+ } else {
+ return errors.Wrap(err, "failed to get bucket")
}
if f.projectNumber == "" {