From ce7510a80f9afdff8ce8694cf0eef180cefb3e15 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 3 Jun 2020 20:17:54 +0200 Subject: [PATCH] [API] on 500 error only show message if gitea in dev mode (#11641) * add API specific InternalServerError() * return 500 error msg only if not Production mode * rm unnessesary change --- modules/context/api.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/context/api.go b/modules/context/api.go index 963c5c14f3..5d91ac49a3 100644 --- a/modules/context/api.go +++ b/modules/context/api.go @@ -77,6 +77,10 @@ func (ctx *APIContext) Error(status int, title string, obj interface{}) { if status == http.StatusInternalServerError { log.ErrorWithSkip(1, "%s: %s", title, message) + + if macaron.Env == macaron.PROD { + message = "" + } } ctx.JSON(status, APIError{