aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-10-26 00:24:19 +0100
committerGitHub <noreply@github.com>2021-10-26 01:24:19 +0200
commit849356deaf204c3f3f186d7fffb2520e1980f46f (patch)
tree87c5139929dad762612e6c178096791404967f7a /routers
parent0277603878a04ca66ca525bf0e53afb0c16ee116 (diff)
downloadgitea-849356deaf204c3f3f186d7fffb2520e1980f46f.tar.gz
gitea-849356deaf204c3f3f186d7fffb2520e1980f46f.zip
Prevent panic in serv.go with Deploy Keys (#17434)
Unfortunately there was a regression in #17373 which missed that the user is not for deploy keys. This leads to a panic when pushing with deploy keys. Fix #17412 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers')
-rw-r--r--routers/private/serv.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/private/serv.go b/routers/private/serv.go
index 8a2e96e15c..b3edd7fc24 100644
--- a/routers/private/serv.go
+++ b/routers/private/serv.go
@@ -283,7 +283,7 @@ func ServCommand(ctx *context.PrivateContext) {
(mode > models.AccessModeRead ||
repo.IsPrivate ||
owner.Visibility.IsPrivate() ||
- user.IsRestricted ||
+ (user != nil && user.IsRestricted) || // user will be nil if the key is a deploykey
setting.Service.RequireSignInView) {
if key.Type == models.KeyTypeDeploy {
if deployKey.Mode < mode {