diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-01-31 21:36:57 +0800 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-01-31 13:36:57 +0000 |
commit | bbad9b617869ce05db2f33cd113f3a581316cee3 (patch) | |
tree | b25c4224416304c8c6cfa897fb7dc5b6ced72a08 /modules/lfs | |
parent | 0823791d1793dc28b0c374dd332e9d1b24acfee1 (diff) | |
download | gitea-bbad9b617869ce05db2f33cd113f3a581316cee3.tar.gz gitea-bbad9b617869ce05db2f33cd113f3a581316cee3.zip |
Fix bug when read public repo lfs file (#5912)
* fix bug when read public repo lfs file
* add comment on lfs permission check
Diffstat (limited to 'modules/lfs')
-rw-r--r-- | modules/lfs/server.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/lfs/server.go b/modules/lfs/server.go index 58acbb807e..188a6b8d57 100644 --- a/modules/lfs/server.go +++ b/modules/lfs/server.go @@ -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) |