mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-01 16:30:02 -05:00
Reva bump 2.35.0 (#1255)
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
+15
-8
@@ -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")
|
||||
|
||||
+17
-7
@@ -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 {
|
||||
|
||||
+10
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user