mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 12:34:11 +01:00
Removed HTTP 500 error on the release page when a user deleted their account
This commit is contained in:
parent
e797a225b6
commit
6b3e47b103
1 changed files with 12 additions and 4 deletions
|
@ -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 a new issue