From 8a8611cf74de49500a845964aa09c1b87d19231e Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Sat, 10 Oct 2020 23:24:39 +0100 Subject: [PATCH] s3: Stat() to filter object name when falling back to listing (#3449) client S3 Stat() API tries to use HEAD requests but fall back to regular listing when there is a permission issue with HEAD or when the object is encrypted using SSE-C. However the code accepts any entry from the minio-go listing API which is wrong. It needs to only accept the object name as passed by the the upper layer. --- cmd/client-s3.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/client-s3.go b/cmd/client-s3.go index 9a8592f0..d9783bb7 100644 --- a/cmd/client-s3.go +++ b/cmd/client-s3.go @@ -1433,6 +1433,10 @@ func (c *S3Client) Stat(ctx context.Context, opts StatOptions) (*ClientContent, return nil, probe.NewError(objectStat.Err) } + if objectStat.Key != object { + break + } + return c.objectInfo2ClientContent(bucket, objectStat), nil }