From 27d9bd04e54435a5445e9653799f508295619474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=9E=E9=9B=AA=E6=97=A0=E6=83=85?= Date: Mon, 28 Sep 2020 01:24:04 +0800 Subject: [PATCH] Handling unhandled errors in the InfoCannedPolicy method. (#10575) --- cmd/admin-handlers-users.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/admin-handlers-users.go b/cmd/admin-handlers-users.go index 3aff70741..0f2f29bca 100644 --- a/cmd/admin-handlers-users.go +++ b/cmd/admin-handlers-users.go @@ -722,7 +722,10 @@ func (a adminAPIHandlers) InfoCannedPolicy(w http.ResponseWriter, r *http.Reques return } - json.NewEncoder(w).Encode(policy) + if err = json.NewEncoder(w).Encode(policy); err != nil { + writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL) + return + } w.(http.Flusher).Flush() }