From 849356deaf204c3f3f186d7fffb2520e1980f46f Mon Sep 17 00:00:00 2001 From: zeripath Date: Tue, 26 Oct 2021 00:24:19 +0100 Subject: [PATCH] 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 --- routers/private/serv.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/private/serv.go b/routers/private/serv.go index 8a2e96e15c4c..b3edd7fc2460 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 {