Skip to content

Commit bbad9b6

Browse files
lunnyzeripath
authored andcommitted
Fix bug when read public repo lfs file (#5912)
* fix bug when read public repo lfs file * add comment on lfs permission check
1 parent 0823791 commit bbad9b6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

modules/lfs/server.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,12 +497,15 @@ func authenticate(ctx *context.Context, repository *models.Repository, authoriza
497497
accessMode = models.AccessModeWrite
498498
}
499499

500+
// ctx.IsSigned is unnecessary here, this will be checked in perm.CanAccess
500501
perm, err := models.GetUserRepoPermission(repository, ctx.User)
501502
if err != nil {
502503
return false
503504
}
504-
if ctx.IsSigned {
505-
return perm.CanAccess(accessMode, models.UnitTypeCode)
505+
506+
canRead := perm.CanAccess(accessMode, models.UnitTypeCode)
507+
if canRead {
508+
return true
506509
}
507510

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

0 commit comments

Comments
 (0)