From 8f0182c3229dfbb8d731557e5006e39bd616b4e9 Mon Sep 17 00:00:00 2001 From: John Olheiser <42128690+jolheiser@users.noreply.github.com> Date: Wed, 12 Jun 2019 16:07:24 -0500 Subject: API error cleanup (#7186) --- modules/context/api.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'modules/context') diff --git a/modules/context/api.go b/modules/context/api.go index 61f6514759..9be3fb512c 100644 --- a/modules/context/api.go +++ b/modules/context/api.go @@ -7,14 +7,11 @@ package context import ( "fmt" - "net/url" - "path" "strings" "github.com/go-macaron/csrf" "code.gitea.io/gitea/models" - "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" @@ -76,7 +73,7 @@ func (ctx *APIContext) Error(status int, title string, obj interface{}) { ctx.JSON(status, APIError{ Message: message, - URL: base.DocURL, + URL: setting.API.SwaggerURL, }) } @@ -180,15 +177,9 @@ func (ctx *APIContext) NotFound(objs ...interface{}) { } } - u, err := url.Parse(setting.AppURL) - if err != nil { - ctx.Error(500, "Invalid AppURL", err) - return - } - u.Path = path.Join(u.Path, "api", "swagger") ctx.JSON(404, map[string]interface{}{ "message": message, - "documentation_url": u.String(), + "documentation_url": setting.API.SwaggerURL, "errors": errors, }) } -- cgit v1.2.3