diff options
author | Unknwon <u@gogs.io> | 2016-02-10 16:11:56 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-02-10 16:11:56 -0500 |
commit | 0ad5f51059c3d7397b8a1b559cb4df69026ebb26 (patch) | |
tree | 7a9ce176091b8e6fd6306f6366fe3b2ee937e336 /routers | |
parent | 297e772c20382afa31ad30ab65827ce0aca58446 (diff) | |
parent | 6b3e47b10364e5aa942b42b9a4b35c16bcdf2e6a (diff) | |
download | gitea-0ad5f51059c3d7397b8a1b559cb4df69026ebb26.tar.gz gitea-0ad5f51059c3d7397b8a1b559cb4df69026ebb26.zip |
Merge pull request #2599 from mhartkorn/fix-release-error-deleted-user
Fix for server error on release page when a user deleted their account
Diffstat (limited to 'routers')
-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. |