mirror of
https://github.com/minio/minio.git
synced 2024-12-25 14:45:54 -05:00
gcs: check error on object writer close (#7606)
Fixes #7605. Object metadata should be written to storage only when the object was written successfully
This commit is contained in:
parent
cf2a436bc8
commit
033f3a4d51
@ -915,15 +915,12 @@ func (l *gcsGateway) PutObject(ctx context.Context, bucket string, key string, r
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close the object writer upon success.
|
// Close the object writer upon success.
|
||||||
w.Close()
|
if err := w.Close(); err != nil {
|
||||||
|
|
||||||
attrs, err := object.Attrs(ctx)
|
|
||||||
if err != nil {
|
|
||||||
logger.LogIf(ctx, err)
|
logger.LogIf(ctx, err)
|
||||||
return minio.ObjectInfo{}, gcsToObjectError(err, bucket, key)
|
return minio.ObjectInfo{}, gcsToObjectError(err, bucket, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromGCSAttrsToObjectInfo(attrs), nil
|
return fromGCSAttrsToObjectInfo(w.Attrs()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CopyObject - Copies a blob from source container to destination container.
|
// CopyObject - Copies a blob from source container to destination container.
|
||||||
@ -1093,7 +1090,10 @@ func (l *gcsGateway) PutObjectPart(ctx context.Context, bucket string, key strin
|
|||||||
return minio.PartInfo{}, gcsToObjectError(err, bucket, key)
|
return minio.PartInfo{}, gcsToObjectError(err, bucket, key)
|
||||||
}
|
}
|
||||||
// Make sure to close the object writer upon success.
|
// Make sure to close the object writer upon success.
|
||||||
w.Close()
|
if err := w.Close(); err != nil {
|
||||||
|
logger.LogIf(ctx, err)
|
||||||
|
return minio.PartInfo{}, gcsToObjectError(err, bucket, key)
|
||||||
|
}
|
||||||
return minio.PartInfo{
|
return minio.PartInfo{
|
||||||
PartNumber: partNumber,
|
PartNumber: partNumber,
|
||||||
ETag: etag,
|
ETag: etag,
|
||||||
|
Loading…
Reference in New Issue
Block a user