From 8022a6efd9cb99080381abe23b2fa49919235cf6 Mon Sep 17 00:00:00 2001 From: poornas Date: Tue, 26 Feb 2019 15:09:14 -0800 Subject: [PATCH] Return ETag for 0-byte object prefixes (#7291) Fixes: #7290 --- cmd/fs-v1.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cmd/fs-v1.go b/cmd/fs-v1.go index 6361f5870..b37b20ee1 100644 --- a/cmd/fs-v1.go +++ b/cmd/fs-v1.go @@ -490,20 +490,18 @@ func (fs *FSObjects) GetObjectNInfo(ctx context.Context, bucket, object string, } } - // For a directory, we need to send an reader that returns no bytes. - if hasSuffix(object, slashSeparator) { - // The lock taken above is released when - // objReader.Close() is called by the caller. - return NewGetObjectReaderFromReader(bytes.NewBuffer(nil), ObjectInfo{}, nsUnlocker), nil - } - // Otherwise we get the object info var objInfo ObjectInfo if objInfo, err = fs.getObjectInfo(ctx, bucket, object); err != nil { nsUnlocker() return nil, toObjectErr(err, bucket, object) } - + // For a directory, we need to send an reader that returns no bytes. + if hasSuffix(object, slashSeparator) { + // The lock taken above is released when + // objReader.Close() is called by the caller. + return NewGetObjectReaderFromReader(bytes.NewBuffer(nil), objInfo, nsUnlocker), nil + } // Take a rwPool lock for NFS gateway type deployment rwPoolUnlocker := func() {} if bucket != minioMetaBucket && lockType != noLock {