From 6ebb48b4eac0b8dad0e7a81c3d1ec79697b0fbff Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 27 Feb 2015 19:42:04 -0800 Subject: [PATCH] Add object name validation --- pkg/storage/storage.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 2abf3a632..0216e1283 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -20,6 +20,7 @@ import ( "io" "regexp" "time" + "unicode/utf8" ) type Storage interface { @@ -86,5 +87,11 @@ func IsValidBucket(bucket string) bool { } func IsValidObject(object string) bool { + if len(object) > 1024 || len(object) == 0 { + return false + } + if !utf8.Valid(object) { + return false + } return true }