diff --git a/go.mod b/go.mod index bba05e55b..d8d649cfa 100644 --- a/go.mod +++ b/go.mod @@ -64,7 +64,7 @@ require ( github.com/onsi/gomega v1.37.0 github.com/open-policy-agent/opa v1.6.0 github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250707143759-32eaae12b2ce - github.com/opencloud-eu/reva/v2 v2.34.1-0.20250717130558-81c1803fb574 + github.com/opencloud-eu/reva/v2 v2.35.0 github.com/orcaman/concurrent-map v1.0.0 github.com/pkg/errors v0.9.1 github.com/pkg/xattr v0.4.12 diff --git a/go.sum b/go.sum index e2cf04272..b0d0dd385 100644 --- a/go.sum +++ b/go.sum @@ -868,8 +868,8 @@ github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-202505121527 github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-20250512152754-23325793059a/go.mod h1:pjcozWijkNPbEtX5SIQaxEW/h8VAVZYTLx+70bmB3LY= github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250707143759-32eaae12b2ce h1:tjbIYsW5CFsEbCf5B/KN0Mo1oKU/K+oipgFm2B6wzG4= github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250707143759-32eaae12b2ce/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q= -github.com/opencloud-eu/reva/v2 v2.34.1-0.20250717130558-81c1803fb574 h1:sx7eqVOdc1i+fGk6f3yoAdtPE1vYzAtBchT9kVjAnTk= -github.com/opencloud-eu/reva/v2 v2.34.1-0.20250717130558-81c1803fb574/go.mod h1:UVPwuMjfgPekuh7unWavJSiPihgmk1GYF3xct0q3+X0= +github.com/opencloud-eu/reva/v2 v2.35.0 h1:lKxGiI9yFD7MTeyFJa68BQD+DiB1rQvhC8QePa/Vlc4= +github.com/opencloud-eu/reva/v2 v2.35.0/go.mod h1:UVPwuMjfgPekuh7unWavJSiPihgmk1GYF3xct0q3+X0= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= diff --git a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/trashbin/trashbin.go b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/trashbin/trashbin.go index 79edd177b..db50a922b 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/trashbin/trashbin.go +++ b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/trashbin/trashbin.go @@ -359,7 +359,7 @@ func (tb *Trashbin) RestoreRecycleItem(ctx context.Context, spaceID string, key, } // cleanup trash info - if relativePath == "." || relativePath == "/" { + if relativePath == "" || relativePath == "." || relativePath == "/" { return restoredNode, os.Remove(filepath.Join(trashRoot, "info", key+".trashinfo")) } else { return restoredNode, nil diff --git a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/assimilation.go b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/assimilation.go index 399008451..4157a61d4 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/assimilation.go +++ b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/assimilation.go @@ -773,18 +773,22 @@ func (t *Tree) WarmupIDCache(root string, assimilate, onlyDirty bool) error { sizes := make(map[string]int64) err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { - // skip lock and upload files - if t.isIndex(path) || isTrash(path) || t.isUpload(path) { - return filepath.SkipDir - } - if t.isInternal(path) || isLockFile(path) { - return nil - } - if err != nil { return err } + // skip irrelevant files + if t.isInternal(path) || + isLockFile(path) || + isTrash(path) || + t.isUpload(path) || + t.isIndex(path) { + return filepath.SkipDir + } + if t.isRootPath(path) { + return nil // ignore the root paths + } + // calculate tree sizes if !info.IsDir() { dir := path @@ -867,6 +871,9 @@ func (t *Tree) WarmupIDCache(root string, assimilate, onlyDirty bool) error { }) for dir, size := range sizes { + if t.isRootPath(dir) { + continue + } spaceID, id, err := t.lookup.IDsForPath(context.Background(), dir) if err != nil { t.log.Error().Err(err).Str("path", dir).Msg("could not get ids for path") diff --git a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/tree.go b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/tree.go index a8e359098..c15e7ba67 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/tree.go +++ b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/tree.go @@ -51,6 +51,7 @@ import ( "github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/permissions" "github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/tree/propagator" "github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/usermapper" + "github.com/opencloud-eu/reva/v2/pkg/storage/utils/templates" "github.com/opencloud-eu/reva/v2/pkg/utils" ) @@ -77,7 +78,9 @@ type Tree struct { propagator propagator.Propagator permissions permissions.Permissions - options *options.Options + options *options.Options + personalSpacesRoot string + projectSpacesRoot string userMapper usermapper.Mapper idCache store.Store @@ -95,6 +98,7 @@ type PermissionCheckFunc func(rp *provider.ResourcePermissions) bool // New returns a new instance of Tree func New(lu node.PathLookup, bs node.Blobstore, um usermapper.Mapper, trashbin *trashbin.Trashbin, permissions permissions.Permissions, o *options.Options, es events.Stream, cache store.Store, log *zerolog.Logger) (*Tree, error) { scanQueue := make(chan scanItem) + t := &Tree{ lookup: lu.(*lookup.Lookup), blobstore: bs, @@ -108,8 +112,10 @@ func New(lu node.PathLookup, bs node.Blobstore, um usermapper.Mapper, trashbin * scanDebouncer: NewScanDebouncer(o.ScanDebounceDelay, func(item scanItem) { scanQueue <- item }), - es: es, - log: log, + es: es, + log: log, + personalSpacesRoot: filepath.Clean(filepath.Join(o.Root, templates.Base(o.PersonalSpacePathTemplate))), + projectSpacesRoot: filepath.Clean(filepath.Join(o.Root, templates.Base(o.GeneralSpacePathTemplate))), } // Start watching for fs events and put them into the queue @@ -665,7 +671,7 @@ func (t *Tree) createDirNode(ctx context.Context, n *node.Node) (err error) { } func (t *Tree) isIgnored(path string) bool { - return isLockFile(path) || isTrash(path) || t.isUpload(path) || t.isInternal(path) + return isLockFile(path) || isTrash(path) || t.isUpload(path) || t.isInternal(path) || t.isRootPath(path) } func (t *Tree) isUpload(path string) bool { @@ -676,10 +682,14 @@ func (t *Tree) isIndex(path string) bool { return strings.HasPrefix(path, filepath.Join(t.options.Root, "indexes")) } -func (t *Tree) isInternal(path string) bool { +func (t *Tree) isRootPath(path string) bool { return path == t.options.Root || - path == filepath.Join(t.options.Root, "users") || - t.isIndex(path) || strings.Contains(path, lookup.MetadataDir) + path == t.personalSpacesRoot || + path == t.projectSpacesRoot +} + +func (t *Tree) isInternal(path string) bool { + return t.isIndex(path) || strings.Contains(path, lookup.MetadataDir) } func isLockFile(path string) bool { diff --git a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/utils/templates/templates.go b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/utils/templates/templates.go index 80ef1cc2f..31c72942a 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/utils/templates/templates.go +++ b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/utils/templates/templates.go @@ -71,6 +71,16 @@ type ( } ) +// Base returns the base path for the given template string. +func Base(tpl string) string { + tpl = clean(tpl) + + if i := strings.Index(tpl, "{{"); i != -1 { + return tpl[0:i] + } + return tpl +} + // WithUser generates a layout based on user data. func WithUser(u *userpb.User, tpl string) string { tpl = clean(tpl) diff --git a/vendor/modules.txt b/vendor/modules.txt index ef2314b01..8924ad4d5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1213,7 +1213,7 @@ github.com/open-policy-agent/opa/v1/version # github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250707143759-32eaae12b2ce ## explicit; go 1.18 github.com/opencloud-eu/libre-graph-api-go -# github.com/opencloud-eu/reva/v2 v2.34.1-0.20250717130558-81c1803fb574 +# github.com/opencloud-eu/reva/v2 v2.35.0 ## explicit; go 1.24.1 github.com/opencloud-eu/reva/v2/cmd/revad/internal/grace github.com/opencloud-eu/reva/v2/cmd/revad/runtime