Add missing comment key from key list (#9313)

Continuing from previous PR #9304, comment
is a special key is not present in the
default KV list. Add it explicitly when
tokenizing fields as it may be possible that
some clients might try to set comments.
This commit is contained in:
Harshavardhana
2020-04-10 11:44:28 -07:00
committed by GitHub
parent 79bcb705bf
commit b412a222ae

View File

@@ -200,9 +200,17 @@ func (kvs KVS) Empty() bool {
// Keys returns the list of keys for the current KVS
func (kvs KVS) Keys() []string {
var keys = make([]string, len(kvs))
var foundComment bool
for i := range kvs {
if kvs[i].Key == madmin.CommentKey {
foundComment = true
}
keys[i] = kvs[i].Key
}
// Comment KV not found, add it explicitly.
if !foundComment {
keys = append(keys, madmin.CommentKey)
}
return keys
}