fix call toAPIErrorCode with a nil value error after check another err (#21083)

if check lerr != nil and return a toAPIErrorCode(nil)

it should  return toAPIErrorCode(lerr)
This commit is contained in:
alingse 2025-04-01 04:31:15 +08:00 committed by GitHub
parent 53d40e41bc
commit 9aa24b1920
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -295,7 +295,7 @@ func checkPutObjectLockAllowed(ctx context.Context, rq *http.Request, bucket, ob
if legalHoldRequested {
var lerr error
if legalHold, lerr = objectlock.ParseObjectLockLegalHoldHeaders(rq.Header); lerr != nil {
return mode, retainDate, legalHold, toAPIErrorCode(ctx, err)
return mode, retainDate, legalHold, toAPIErrorCode(ctx, lerr)
}
}