Merge pull request #217 from harshavardhana/pr_out_use_validstring

master
Harshavardhana 10 years ago
commit acee4d16fd
  1. 4
      pkg/storage/fs/fs.go
  2. 2
      pkg/storage/storage.go

@ -242,7 +242,7 @@ func (storage *storage) GetObjectMetadata(bucket string, object string) (mstorag
return mstorage.ObjectMetadata{}, mstorage.BucketNameInvalid{Bucket: bucket} return mstorage.ObjectMetadata{}, mstorage.BucketNameInvalid{Bucket: bucket}
} }
if mstorage.IsValidObject(bucket) == false { if mstorage.IsValidObject(object) == false {
return mstorage.ObjectMetadata{}, mstorage.ObjectNameInvalid{Bucket: bucket, Object: bucket} return mstorage.ObjectMetadata{}, mstorage.ObjectNameInvalid{Bucket: bucket, Object: bucket}
} }
@ -327,7 +327,7 @@ func (storage *storage) ListObjects(bucket string, resources mstorage.BucketReso
if mstorage.IsValidBucket(bucket) == false { if mstorage.IsValidBucket(bucket) == false {
return []mstorage.ObjectMetadata{}, resources, mstorage.BucketNameInvalid{Bucket: bucket} return []mstorage.ObjectMetadata{}, resources, mstorage.BucketNameInvalid{Bucket: bucket}
} }
if mstorage.IsValidObject(resources.Prefix) == false { if resources.Prefix != "" && mstorage.IsValidObject(resources.Prefix) == false {
return []mstorage.ObjectMetadata{}, resources, mstorage.ObjectNameInvalid{Bucket: bucket, Object: resources.Prefix} return []mstorage.ObjectMetadata{}, resources, mstorage.ObjectNameInvalid{Bucket: bucket, Object: resources.Prefix}
} }

@ -90,7 +90,7 @@ func IsValidObject(object string) bool {
if len(object) > 1024 || len(object) == 0 { if len(object) > 1024 || len(object) == 0 {
return false return false
} }
if !utf8.Valid(object) { if !utf8.ValidString(object) {
return false return false
} }
return true return true

Loading…
Cancel
Save