Compare commits

...

2 Commits

Author SHA1 Message Date
Feng Ruohang bcb5fc9566 Merge pull request #225 from cbornet/error-messages
Align some checksum error messages with S3

Signed-off-by: Feng Ruohang <rh@vonng.com>
2026-09-26 09:03:50 +08:00
cbornet 394d9db212 Align some checksum error messages with S3
Signed-off-by: cbornet <cbornet@hotmail.com>
2026-09-25 17:44:52 +02:00
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -550,7 +550,7 @@ var errorCodes = errorCodeMap{
}, },
ErrBadDigest: { ErrBadDigest: {
Code: "BadDigest", Code: "BadDigest",
Description: "The Content-Md5 you specified did not match what we received.", Description: "The Content-MD5 you specified did not match what we received.",
HTTPStatusCode: http.StatusBadRequest, HTTPStatusCode: http.StatusBadRequest,
}, },
ErrEntityTooSmall: { ErrEntityTooSmall: {
+2 -2
View File
@@ -253,7 +253,7 @@ func testAPICompleteMultipartFullObjectChecksumMismatch(obj ObjectLayer, instanc
if apiErr.Code != "BadDigest" { if apiErr.Code != "BadDigest" {
t.Fatalf("%s: expected BadDigest, got %q", instanceType, apiErr.Code) t.Fatalf("%s: expected BadDigest, got %q", instanceType, apiErr.Code)
} }
if want := "The CRC32 checksum you specified did not match the calculated checksum."; apiErr.Message != want { if want := "The CRC32 you specified did not match the calculated checksum."; apiErr.Message != want {
t.Fatalf("%s: expected message %q, got %q", instanceType, want, apiErr.Message) t.Fatalf("%s: expected message %q, got %q", instanceType, want, apiErr.Message)
} }
@@ -361,7 +361,7 @@ func testAPICompleteMultipartCompositeChecksumMismatch(obj ObjectLayer, instance
if apiErr.Code != "BadDigest" { if apiErr.Code != "BadDigest" {
t.Fatalf("%s: expected BadDigest, got %q", instanceType, apiErr.Code) t.Fatalf("%s: expected BadDigest, got %q", instanceType, apiErr.Code)
} }
if want := "The CRC32 checksum you specified did not match the calculated checksum."; apiErr.Message != want { if want := "The CRC32 you specified did not match the calculated checksum."; apiErr.Message != want {
t.Fatalf("%s: expected message %q, got %q", instanceType, want, apiErr.Message) t.Fatalf("%s: expected message %q, got %q", instanceType, want, apiErr.Message)
} }
if _, err := obj.GetObjectInfo(t.Context(), bucketName, objectName, ObjectOptions{}); err == nil { if _, err := obj.GetObjectInfo(t.Context(), bucketName, objectName, ObjectOptions{}); err == nil {
+1 -1
View File
@@ -668,7 +668,7 @@ var (
func completeMultipartChecksumMismatch(algorithm string) error { func completeMultipartChecksumMismatch(algorithm string) error {
description := "The checksum you specified did not match the calculated checksum." description := "The checksum you specified did not match the calculated checksum."
if algorithm != "" { if algorithm != "" {
description = fmt.Sprintf("The %s checksum you specified did not match the calculated checksum.", algorithm) description = fmt.Sprintf("The %s you specified did not match the calculated checksum.", algorithm)
} }
return fmt.Errorf("%w: %s", errCompleteMultipartChecksumMismatch, description) return fmt.Errorf("%w: %s", errCompleteMultipartChecksumMismatch, description)
} }