Use validString
This commit is contained in:
parent
27fab98bf9
commit
d5e5a3b3e6
2 changed files with 3 additions and 3 deletions
|
@ -242,7 +242,7 @@ func (storage *storage) GetObjectMetadata(bucket string, object string) (mstorag
|
|||
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}
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ func (storage *storage) ListObjects(bucket string, resources mstorage.BucketReso
|
|||
if mstorage.IsValidBucket(bucket) == false {
|
||||
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}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ func IsValidObject(object string) bool {
|
|||
if len(object) > 1024 || len(object) == 0 {
|
||||
return false
|
||||
}
|
||||
if !utf8.Valid(object) {
|
||||
if !utf8.ValidString(object) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
|
Loading…
Reference in a new issue