1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00

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>
This commit is contained in:
zeripath 2021-10-26 00:24:19 +01:00 committed by GitHub
parent 0277603878
commit 849356deaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {