1
mirror of https://github.com/rclone/rclone synced 2025-01-07 09:06:24 +01:00

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

Previously we would check the bucket's status and on error we would
try to create it.  Now we only try to create it if we got a not found
error, otherwise we report the error to the user.
This commit is contained in:
Nick Craig-Wood 2017-08-10 10:29:21 +01:00
parent 265fb8a5e2
commit 76c5aa8533

View File

@ -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 == "" {