Fix missing risk challenge response

This commit is contained in:
richjohnrambo
2026-08-29 10:59:50 +08:00
parent 42916b85aa
commit 866222cb39
3 changed files with 34 additions and 0 deletions
+5
View File
@@ -53,6 +53,7 @@ const (
imReasonUnsupportedMedia = "UNSUPPORTED_MEDIA_TYPE"
imReasonFileUnavailable = "FILE_UNAVAILABLE"
imReasonRateLimited = "RATE_LIMITED"
imReasonResourceNotFound = "RESOURCE_NOT_FOUND"
)
const (
@@ -1257,6 +1258,10 @@ func serveIMRiskChallengeConfirm(wrt http.ResponseWriter, req *http.Request) {
}
challenge, err := store.Safety.ConfirmRiskChallenge(principal.TenantID, principal.Uid, challengeID, decision, tokenID, time.Now().UTC().Round(time.Millisecond))
if err != nil {
if errors.Is(err, types.ErrNotFound) {
writeIMError(wrt, req, http.StatusNotFound, 30004, imReasonResourceNotFound, "risk challenge not found", nil)
return
}
writeIMRelationError(wrt, req, err)
return
}