Avoid creating session when cp detects object exists as directory (#1758)
This commit is contained in:
committed by
Harshavardhana
parent
e53fa1a5a2
commit
9be8aebfff
@@ -74,6 +74,15 @@ func (e ObjectAlreadyExists) Error() string {
|
||||
return "Object ‘" + e.Object + "’ already exists."
|
||||
}
|
||||
|
||||
// ObjectAlreadyExistsAsDirectory - typed return for XMinioObjectExistsAsDirectory
|
||||
type ObjectAlreadyExistsAsDirectory struct {
|
||||
Object string
|
||||
}
|
||||
|
||||
func (e ObjectAlreadyExistsAsDirectory) Error() string {
|
||||
return "Object ‘" + e.Object + "’ already exists as directory."
|
||||
}
|
||||
|
||||
// ObjectOnGlacier - object is of storage class glacier.
|
||||
type ObjectOnGlacier struct {
|
||||
Object string
|
||||
|
||||
@@ -236,6 +236,11 @@ func (c *s3Client) Put(reader io.Reader, size int64, contentType string, progres
|
||||
Object: object,
|
||||
})
|
||||
}
|
||||
if errResponse.Code == "XMinioObjectExistsAsDirectory" {
|
||||
return n, probe.NewError(ObjectAlreadyExistsAsDirectory{
|
||||
Object: object,
|
||||
})
|
||||
}
|
||||
if errResponse.Code == "NoSuchBucket" {
|
||||
return n, probe.NewError(BucketDoesNotExist{
|
||||
Bucket: bucket,
|
||||
|
||||
+1
-1
@@ -352,7 +352,7 @@ func doCopySession(session *sessionV7) {
|
||||
case BrokenSymlink, TooManyLevelsSymlink, PathNotFound, PathInsufficientPermission:
|
||||
continue
|
||||
// Handle these specifically for object storage related errors.
|
||||
case BucketNameEmpty, ObjectMissing, ObjectAlreadyExists, BucketDoesNotExist, BucketInvalid, ObjectOnGlacier:
|
||||
case BucketNameEmpty, ObjectMissing, ObjectAlreadyExists, ObjectAlreadyExistsAsDirectory, BucketDoesNotExist, BucketInvalid, ObjectOnGlacier:
|
||||
continue
|
||||
}
|
||||
// For critical errors we should exit. Session
|
||||
|
||||
Reference in New Issue
Block a user