mirror of
https://gitee.com/gitea/gitea.git
synced 2024-11-30 10:47:40 +08:00
Merge pull request #2599 from mhartkorn/fix-release-error-deleted-user
Fix for server error on release page when a user deleted their account
This commit is contained in:
commit
0ad5f51059
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user