Skip to content

Commit dd1ba34

Browse files
authored
Prevent panic in serv.go with Deploy Keys (go-gitea#17434) (go-gitea#17435)
Backport go-gitea#17434 Unfortunately there was a regression in go-gitea#17373 which missed that the user is not for deploy keys. This leads to a panic when pushing with deploy keys. Fix go-gitea#17412 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 1fbdf96 commit dd1ba34

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

routers/private/serv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ func ServCommand(ctx *context.PrivateContext) {
282282
(mode > models.AccessModeRead ||
283283
repo.IsPrivate ||
284284
owner.Visibility.IsPrivate() ||
285-
user.IsRestricted ||
285+
(user != nil && user.IsRestricted) || // user will be nil if the key is a deploykey
286286
setting.Service.RequireSignInView) {
287287
if key.Type == models.KeyTypeDeploy {
288288
if deployKey.Mode < mode {

0 commit comments

Comments
 (0)