|
|
@ -20,6 +20,7 @@ import ( |
|
|
|
"crypto/md5" |
|
|
|
"crypto/md5" |
|
|
|
"crypto/sha256" |
|
|
|
"crypto/sha256" |
|
|
|
"encoding/hex" |
|
|
|
"encoding/hex" |
|
|
|
|
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"hash" |
|
|
|
"hash" |
|
|
|
"io" |
|
|
|
"io" |
|
|
@ -151,10 +152,12 @@ func (fs fsObjects) ListBuckets() ([]BucketInfo, error) { |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, toObjectErr(traceError(err)) |
|
|
|
return nil, toObjectErr(traceError(err)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var invalidBucketNames []string |
|
|
|
for _, vol := range vols { |
|
|
|
for _, vol := range vols { |
|
|
|
// StorageAPI can send volume names which are incompatible
|
|
|
|
// StorageAPI can send volume names which are incompatible
|
|
|
|
// with buckets, handle it and skip them.
|
|
|
|
// with buckets, handle it and skip them.
|
|
|
|
if !IsValidBucketName(vol.Name) { |
|
|
|
if !IsValidBucketName(vol.Name) { |
|
|
|
|
|
|
|
invalidBucketNames = append(invalidBucketNames, vol.Name) |
|
|
|
continue |
|
|
|
continue |
|
|
|
} |
|
|
|
} |
|
|
|
// Ignore the volume special bucket.
|
|
|
|
// Ignore the volume special bucket.
|
|
|
@ -166,6 +169,11 @@ func (fs fsObjects) ListBuckets() ([]BucketInfo, error) { |
|
|
|
Created: vol.Created, |
|
|
|
Created: vol.Created, |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Print a user friendly message if we indeed skipped certain folders which are
|
|
|
|
|
|
|
|
// incompatible with S3's bucket name restrictions.
|
|
|
|
|
|
|
|
if len(invalidBucketNames) > 0 { |
|
|
|
|
|
|
|
errorIf(errors.New("One or more invalid bucket names found"), "Skipping %s", invalidBucketNames) |
|
|
|
|
|
|
|
} |
|
|
|
sort.Sort(byBucketName(bucketInfos)) |
|
|
|
sort.Sort(byBucketName(bucketInfos)) |
|
|
|
return bucketInfos, nil |
|
|
|
return bucketInfos, nil |
|
|
|
} |
|
|
|
} |
|
|
|