diff --git a/pkg/storage/fs/fs.go b/pkg/storage/fs/fs.go index cecf17fa1..06a818e7e 100644 --- a/pkg/storage/fs/fs.go +++ b/pkg/storage/fs/fs.go @@ -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} } diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 0216e1283..5814b2bad 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -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