From b412a222ae34ad38c2fb81411f652a7bfbd8e80e Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 10 Apr 2020 11:44:28 -0700 Subject: [PATCH] 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. --- cmd/config/config.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/config/config.go b/cmd/config/config.go index bddbf150d..5b87d0914 100644 --- a/cmd/config/config.go +++ b/cmd/config/config.go @@ -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 }