From c82acc599ad3fd83518c9584b702e6ad942f7e31 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 13 Nov 2018 11:57:03 -0800 Subject: [PATCH] Treat empty xl.json as file not found (#6804) If the buffer is empty we can avoid parsing it and treat it essentially as `xl.json` is effectively missing. --- cmd/xl-v1-utils.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/xl-v1-utils.go b/cmd/xl-v1-utils.go index 83b8f3664..12efa4101 100644 --- a/cmd/xl-v1-utils.go +++ b/cmd/xl-v1-utils.go @@ -311,6 +311,9 @@ func readXLMeta(ctx context.Context, disk StorageAPI, bucket string, object stri } return xlMetaV1{}, err } + if len(xlMetaBuf) == 0 { + return xlMetaV1{}, errFileNotFound + } // obtain xlMetaV1{} using `github.com/tidwall/gjson`. xlMeta, err = xlMetaV1UnmarshalJSON(ctx, xlMetaBuf) if err != nil {