Browse Source

Fix bug when read public repo lfs file (#5912)

* fix bug when read public repo lfs file

* add comment on lfs permission check
tags/v1.21.12.1
Lunny Xiao zeripath 6 years ago
parent
commit
bbad9b6178
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      modules/lfs/server.go

+ 5
- 2
modules/lfs/server.go View File

@@ -497,12 +497,15 @@ func authenticate(ctx *context.Context, repository *models.Repository, authoriza
accessMode = models.AccessModeWrite
}

// ctx.IsSigned is unnecessary here, this will be checked in perm.CanAccess
perm, err := models.GetUserRepoPermission(repository, ctx.User)
if err != nil {
return false
}
if ctx.IsSigned {
return perm.CanAccess(accessMode, models.UnitTypeCode)

canRead := perm.CanAccess(accessMode, models.UnitTypeCode)
if canRead {
return true
}

user, repo, opStr, err := parseToken(authorization)


Loading…
Cancel
Save