From de61aef66ed47e08913fe874518918b2f7a2a3e3 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 30 May 2024 13:46:25 +0300 Subject: [PATCH] [#140] native,s3: Do not set `Success` flag on hash mismatch Signed-off-by: Evgenii Stratonikov --- internal/native/client.go | 2 +- internal/s3/client.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/native/client.go b/internal/native/client.go index cfd0308..5979ae3 100644 --- a/internal/native/client.go +++ b/internal/native/client.go @@ -240,7 +240,7 @@ func (c *Client) VerifyHash(containerID, objectID, expectedHash string) VerifyHa } actualHash := hex.EncodeToString(hasher.Sum(nil)) if actualHash != expectedHash { - return VerifyHashResponse{Success: true, Error: "hash mismatch"} + return VerifyHashResponse{Success: false, Error: "hash mismatch"} } return VerifyHashResponse{Success: true} diff --git a/internal/s3/client.go b/internal/s3/client.go index 4d15bd2..0765807 100644 --- a/internal/s3/client.go +++ b/internal/s3/client.go @@ -180,7 +180,7 @@ func (c *Client) VerifyHash(bucket, key, expectedHash string) VerifyHashResponse } actualHash := hex.EncodeToString(hasher.Sum(nil)) if actualHash != expectedHash { - return VerifyHashResponse{Success: true, Error: "hash mismatch"} + return VerifyHashResponse{Success: false, Error: "hash mismatch"} } return VerifyHashResponse{Success: true} -- 2.45.2