Skip to content

Commit

Permalink
Fix bug when read public repo lfs file (#5913)
Browse files Browse the repository at this point in the history
* fix bug when read public repo lfs file

* add comment on lfs permission check
  • Loading branch information
lunny authored and zeripath committed Jan 31, 2019
1 parent e5af93a commit 9d4aa78
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/lfs/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9d4aa78

Please sign in to comment.