mirror of
https://github.com/minio/minio.git
synced 2025-01-14 00:05:02 -05:00
Use validString
This commit is contained in:
parent
27fab98bf9
commit
d5e5a3b3e6
@ -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…
Reference in New Issue
Block a user