summaryrefslogtreecommitdiffstats
path: root/routers/web/repo/lfs.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/repo/lfs.go')
-rw-r--r--routers/web/repo/lfs.go28
1 files changed, 18 insertions, 10 deletions
diff --git a/routers/web/repo/lfs.go b/routers/web/repo/lfs.go
index 28d6b12860..6cc05430dd 100644
--- a/routers/web/repo/lfs.go
+++ b/routers/web/repo/lfs.go
@@ -421,12 +421,13 @@ func LFSPointerFiles(ctx *context.Context) {
var numAssociated, numNoExist, numAssociatable int
type pointerResult struct {
- SHA string
- Oid string
- Size int64
- InRepo bool
- Exists bool
- Accessible bool
+ SHA string
+ Oid string
+ Size int64
+ InRepo bool
+ Exists bool
+ Accessible bool
+ Associatable bool
}
results := []pointerResult{}
@@ -461,22 +462,29 @@ func LFSPointerFiles(ctx *context.Context) {
// Can we fix?
// OK well that's "simple"
// - we need to check whether current user has access to a repo that has access to the file
- result.Accessible, err = models.LFSObjectAccessible(ctx.User, pointerBlob.Oid)
+ result.Associatable, err = models.LFSObjectAccessible(ctx.User, pointerBlob.Oid)
if err != nil {
return err
}
- } else {
- result.Accessible = true
+ if !result.Associatable {
+ associated, err := models.LFSObjectIsAssociated(pointerBlob.Oid)
+ if err != nil {
+ return err
+ }
+ result.Associatable = !associated
+ }
}
}
+ result.Accessible = result.InRepo || result.Associatable
+
if result.InRepo {
numAssociated++
}
if !result.Exists {
numNoExist++
}
- if !result.InRepo && result.Accessible {
+ if result.Associatable {
numAssociatable++
}