diff options
author | Martin Hartkorn <github@hartkorn.net> | 2016-02-10 21:35:58 +0100 |
---|---|---|
committer | Martin Hartkorn <github@hartkorn.net> | 2016-02-10 22:04:11 +0100 |
commit | 6b3e47b10364e5aa942b42b9a4b35c16bcdf2e6a (patch) | |
tree | d61a6c5913a756aaa73baab701daa2ab4e2b6a3c /routers/repo/release.go | |
parent | e797a225b6d1b4d18d8988915d62e9f19073eda1 (diff) | |
download | gitea-6b3e47b10364e5aa942b42b9a4b35c16bcdf2e6a.tar.gz gitea-6b3e47b10364e5aa942b42b9a4b35c16bcdf2e6a.zip |
Removed HTTP 500 error on the release page when a user deleted their account
Diffstat (limited to 'routers/repo/release.go')
-rw-r--r-- | routers/repo/release.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/routers/repo/release.go b/routers/repo/release.go index 880385708f..8baa317e0c 100644 --- a/routers/repo/release.go +++ b/routers/repo/release.go @@ -45,8 +45,12 @@ func Releases(ctx *middleware.Context) { if rel.TagName == rawTag { rel.Publisher, err = models.GetUserByID(rel.PublisherID) if err != nil { - ctx.Handle(500, "GetUserByID", err) - return + if models.IsErrUserNotExist(err) { + rel.Publisher = models.NewFakeUser() + } else { + ctx.Handle(500, "GetUserByID", err) + return + } } // FIXME: duplicated code. // Get corresponding target if it's not the current branch. @@ -105,8 +109,12 @@ func Releases(ctx *middleware.Context) { rel.Publisher, err = models.GetUserByID(rel.PublisherID) if err != nil { - ctx.Handle(500, "GetUserByID", err) - return + if models.IsErrUserNotExist(err) { + rel.Publisher = models.NewFakeUser() + } else { + ctx.Handle(500, "GetUserByID", err) + return + } } // FIXME: duplicated code. // Get corresponding target if it's not the current branch. |