Fix s3 compatibility fixes for getBucketLocation,headBucket,deleteBucket (#5842)

- getBucketLocation
- headBucket
- deleteBucket

Should return 404 or NoSuchBucket even for invalid bucket names, invalid
bucket names are only validated during MakeBucket operation
This commit is contained in:
Harshavardhana
2018-04-23 20:27:33 -07:00
committed by Nitish Tiwari
parent 954142a98f
commit ccdb7bc286
14 changed files with 108 additions and 108 deletions

View File

@@ -261,8 +261,8 @@ func (s *posix) DiskInfo() (info disk.Info, err error) {
// compatible way for all operating systems. If volume is not found
// an error is generated.
func (s *posix) getVolDir(volume string) (string, error) {
if !isValidVolname(volume) {
return "", errInvalidArgument
if volume == "" || volume == "." || volume == ".." {
return "", errVolumeNotFound
}
volumeDir := pathJoin(s.diskPath, volume)
return volumeDir, nil
@@ -301,6 +301,10 @@ func (s *posix) MakeVol(volume string) (err error) {
return err
}
if !isValidVolname(volume) {
return errInvalidArgument
}
volumeDir, err := s.getVolDir(volume)
if err != nil {
return err