Prevent panic in serv.go with Deploy Keys (#17434) (#17435)

Backport #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>
pull/17464/head
zeripath 3 years ago committed by GitHub
parent 1fbdf96c34
commit dd1ba34ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      routers/private/serv.go

@ -282,7 +282,7 @@ func ServCommand(ctx *context.PrivateContext) {
(mode > models.AccessModeRead || (mode > models.AccessModeRead ||
repo.IsPrivate || repo.IsPrivate ||
owner.Visibility.IsPrivate() || owner.Visibility.IsPrivate() ||
user.IsRestricted || (user != nil && user.IsRestricted) || // user will be nil if the key is a deploykey
setting.Service.RequireSignInView) { setting.Service.RequireSignInView) {
if key.Type == models.KeyTypeDeploy { if key.Type == models.KeyTypeDeploy {
if deployKey.Mode < mode { if deployKey.Mode < mode {

Loading…
Cancel
Save