mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-24 22:19:09 -05:00
Merge pull request #2813 from aduffeck/parentid-consistency
Verify parent ids during the consistency check
This commit is contained in:
@@ -64,7 +64,7 @@ require (
|
||||
github.com/open-policy-agent/opa v1.15.2
|
||||
github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89
|
||||
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d
|
||||
github.com/opencloud-eu/reva/v2 v2.46.0
|
||||
github.com/opencloud-eu/reva/v2 v2.46.1-0.20260522083006-063ee129f21e
|
||||
github.com/opensearch-project/opensearch-go/v4 v4.6.0
|
||||
github.com/orcaman/concurrent-map v1.0.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
|
||||
@@ -952,8 +952,8 @@ github.com/opencloud-eu/inotifywaitgo v0.0.0-20251111171128-a390bae3c5e9 h1:dIft
|
||||
github.com/opencloud-eu/inotifywaitgo v0.0.0-20251111171128-a390bae3c5e9/go.mod h1:JWyDC6H+5oZRdUJUgKuaye+8Ph5hEs6HVzVoPKzWSGI=
|
||||
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d h1:JcqGDiyrcaQwVyV861TUyQgO7uEmsjkhfm7aQd84dOw=
|
||||
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q=
|
||||
github.com/opencloud-eu/reva/v2 v2.46.0 h1:wYUHIHOsLP9vad/K19/52RRfoooeHUGY4BSeowNrbpY=
|
||||
github.com/opencloud-eu/reva/v2 v2.46.0/go.mod h1:fWAzVpZlJQEY/qeIrd9d3U+LpqY9JGsjJ2dc0a1jCEs=
|
||||
github.com/opencloud-eu/reva/v2 v2.46.1-0.20260522083006-063ee129f21e h1:T/UAzT0TMNm6C6TasumVGUUZzl6yWsa8SDALXgPLy7Q=
|
||||
github.com/opencloud-eu/reva/v2 v2.46.1-0.20260522083006-063ee129f21e/go.mod h1:fWAzVpZlJQEY/qeIrd9d3U+LpqY9JGsjJ2dc0a1jCEs=
|
||||
github.com/opencloud-eu/secure v0.0.0-20260312082735-b6f5cb2244e4 h1:l2oB/RctH+t8r7QBj5p8thfEHCM/jF35aAY3WQ3hADI=
|
||||
github.com/opencloud-eu/secure v0.0.0-20260312082735-b6f5cb2244e4/go.mod h1:BmF5hyM6tXczk3MpQkFf1hpKSRqCyhqcbiQtiAF7+40=
|
||||
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||
|
||||
@@ -16,9 +16,12 @@ import (
|
||||
"github.com/opencloud-eu/opencloud/services/storage-users/pkg/event"
|
||||
"github.com/opencloud-eu/opencloud/services/storage-users/pkg/revaconfig"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/events"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/ignore"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/options"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/registry"
|
||||
|
||||
"github.com/pkg/xattr"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/theckman/yacspin"
|
||||
"github.com/vmihailenco/msgpack/v5"
|
||||
@@ -35,6 +38,7 @@ const (
|
||||
var (
|
||||
spinner *yacspin.Spinner
|
||||
restartRequired = false
|
||||
ignorer *ignore.Ignorer
|
||||
)
|
||||
|
||||
type IDCacher interface {
|
||||
@@ -153,6 +157,12 @@ func checkPosixfsConsistency(cmd *cobra.Command, cfg *config.Config) error {
|
||||
rootPath, _ := cmd.Flags().GetString("root")
|
||||
indexesPath := filepath.Join(rootPath, "indexes")
|
||||
|
||||
opt, _ := options.New(map[string]interface{}{
|
||||
"root": rootPath,
|
||||
})
|
||||
log := zerolog.Nop()
|
||||
ignorer = ignore.NewIgnorer(opt, &log)
|
||||
|
||||
_, err := os.Stat(indexesPath)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
@@ -209,6 +219,7 @@ func checkSpaces(basePath string) {
|
||||
}
|
||||
|
||||
func checkSpace(spacePath string) {
|
||||
spinner.Message("")
|
||||
spinner.Suffix(fmt.Sprintf(" Checking space '%s'", spacePath))
|
||||
|
||||
info, err := os.Stat(spacePath)
|
||||
@@ -228,10 +239,11 @@ func checkSpace(spacePath string) {
|
||||
}
|
||||
|
||||
checkSpaceID(spacePath)
|
||||
checkNodeIDs(spacePath)
|
||||
}
|
||||
|
||||
func checkSpaceID(spacePath string) {
|
||||
spinner.Message("checking space ID uniqueness")
|
||||
spinner.Message(" - checking space ID uniqueness")
|
||||
|
||||
entries, uniqueIDs, oldestEntry, err := gatherAttributes(spacePath)
|
||||
if err != nil {
|
||||
@@ -240,7 +252,6 @@ func checkSpaceID(spacePath string) {
|
||||
}
|
||||
|
||||
if len(entries) == 0 {
|
||||
logSuccess("(empty space)")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -278,8 +289,65 @@ func checkSpaceID(spacePath string) {
|
||||
}
|
||||
fixSpaceID(spacePath, obsoleteIDs, targetID, entries)
|
||||
spinner.Unpause()
|
||||
} else {
|
||||
logSuccess("")
|
||||
}
|
||||
}
|
||||
|
||||
func walkParentIDs(dir string, parentID string) int {
|
||||
fixes := 0
|
||||
entries, err := os.ReadDir(dir)
|
||||
if err != nil {
|
||||
logFailure("Error reading directory '%s': %v", dir, err)
|
||||
return 0
|
||||
}
|
||||
|
||||
for _, entry := range entries {
|
||||
fullPath := filepath.Join(dir, entry.Name())
|
||||
|
||||
if ignorer.IsIgnored(fullPath) {
|
||||
continue
|
||||
}
|
||||
|
||||
actualParentID, err := xattr.Get(fullPath, parentIDAttrName)
|
||||
if err != nil || string(actualParentID) != parentID {
|
||||
err = xattr.Set(fullPath, parentIDAttrName, []byte(parentID))
|
||||
if err != nil {
|
||||
logFailure("Failed to fix parent ID for '%s': %v", fullPath, err)
|
||||
} else {
|
||||
spinner.Pause()
|
||||
fmt.Printf("\n + Fixed parent ID for '%s'\n", fullPath)
|
||||
spinner.Unpause()
|
||||
fixes++
|
||||
restartRequired = true
|
||||
}
|
||||
}
|
||||
|
||||
if entry.IsDir() {
|
||||
nodeID, err := xattr.Get(fullPath, idAttrName)
|
||||
if err != nil || len(nodeID) == 0 {
|
||||
logFailure("Directory '%s' missing '%s', skipping its children", fullPath, idAttrName)
|
||||
continue
|
||||
}
|
||||
walkParentIDs(fullPath, string(nodeID))
|
||||
}
|
||||
}
|
||||
return fixes
|
||||
}
|
||||
|
||||
func checkNodeIDs(spacePath string) {
|
||||
spinner.Message(" - checking parent IDs")
|
||||
|
||||
rootID, err := xattr.Get(spacePath, idAttrName)
|
||||
if err != nil || len(rootID) == 0 {
|
||||
logFailure("Space root '%s' missing '%s' attribute", spacePath, idAttrName)
|
||||
return
|
||||
}
|
||||
|
||||
fixes := walkParentIDs(spacePath, string(rootID))
|
||||
|
||||
if fixes > 0 {
|
||||
spinner.Pause()
|
||||
fmt.Printf("\n ✓ Fixed %d incorrect parent IDs in %s\n", fixes, filepath.Base(spacePath))
|
||||
spinner.Unpause()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,6 +392,9 @@ func gatherAttributes(path string) ([]EntryInfo, map[string]struct{}, EntryInfo,
|
||||
|
||||
for _, entry := range dirEntries {
|
||||
fullPath := filepath.Join(path, entry.Name())
|
||||
if ignorer.IsIgnored(fullPath) {
|
||||
continue
|
||||
}
|
||||
info, err := os.Stat(fullPath)
|
||||
if err != nil {
|
||||
fmt.Printf(" - Warning: could not stat %s: %v\n", entry.Name(), err)
|
||||
@@ -428,7 +499,7 @@ func updateOwnerIndexFile(basePath string, obsoleteIDs []string) error {
|
||||
return fmt.Errorf("failed to write updated index file: %w", err)
|
||||
}
|
||||
|
||||
logSuccess("Successfully removed %d item(s) and saved index file.\n", itemsRemoved)
|
||||
fmt.Printf(" ✓ Successfully removed %d item(s) and saved index file.\n", itemsRemoved)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -447,13 +518,7 @@ func removeAttributes(path string) error {
|
||||
}
|
||||
|
||||
func logFailure(message string, args ...any) {
|
||||
spinner.StopFailMessage(fmt.Sprintf(message, args...))
|
||||
spinner.StopFailMessage(fmt.Sprintf("\n"+message, args...))
|
||||
spinner.StopFail()
|
||||
spinner.Start()
|
||||
}
|
||||
|
||||
func logSuccess(message string, args ...any) {
|
||||
spinner.StopMessage(fmt.Sprintf(message, args...))
|
||||
spinner.Stop()
|
||||
spinner.Start()
|
||||
}
|
||||
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package ignore
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/blobstore"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/lookup"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/options"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/utils/templates"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
// Ignorer handles checking if paths should be ignored in posix operations
|
||||
type Ignorer struct {
|
||||
options *options.Options
|
||||
log *zerolog.Logger
|
||||
personalSpacesRoot string
|
||||
projectSpacesRoot string
|
||||
}
|
||||
|
||||
// NewIgnorer creates a new Ignorer given the posix options and logger
|
||||
func NewIgnorer(options *options.Options, log *zerolog.Logger) *Ignorer {
|
||||
return &Ignorer{
|
||||
options: options,
|
||||
log: log,
|
||||
personalSpacesRoot: filepath.Clean(filepath.Join(options.Root, templates.Base(options.PersonalSpacePathTemplate))),
|
||||
projectSpacesRoot: filepath.Clean(filepath.Join(options.Root, templates.Base(options.GeneralSpacePathTemplate))),
|
||||
}
|
||||
}
|
||||
|
||||
// IsIgnored checking if paths should be ignored in posix operations
|
||||
func (i *Ignorer) IsIgnored(path string) bool {
|
||||
return IsLockFile(path) || IsTrash(path) || i.IsUpload(path) || i.IsInternal(path) || i.IsRootPath(path) || i.IsSpaceRoot(path)
|
||||
}
|
||||
|
||||
func (i *Ignorer) IsUpload(path string) bool {
|
||||
return strings.HasPrefix(path, i.options.UploadDirectory)
|
||||
}
|
||||
|
||||
func (i *Ignorer) IsIndex(path string) bool {
|
||||
return strings.HasPrefix(path, filepath.Join(i.options.Root, "indexes"))
|
||||
}
|
||||
|
||||
func (i *Ignorer) IsTemporary(path string) bool {
|
||||
if filepath.IsAbs(path) {
|
||||
tmpDirPattern := filepath.Join(i.options.Root, "*", "*", blobstore.TMPDir)
|
||||
isTempDir, err := filepath.Match(tmpDirPattern, path)
|
||||
if err != nil {
|
||||
i.log.Error().Err(err).Str("pattern", tmpDirPattern).Str("path", path).Msg("error matching temporary path")
|
||||
return false
|
||||
}
|
||||
isTempParentDir, err := filepath.Match(tmpDirPattern, filepath.Dir(path))
|
||||
if err != nil {
|
||||
i.log.Error().Err(err).Str("pattern", tmpDirPattern).Str("path", filepath.Dir(path)).Msg("error matching temporary path")
|
||||
return false
|
||||
}
|
||||
return isTempDir || isTempParentDir
|
||||
}
|
||||
return path == blobstore.TMPDir || filepath.Dir(path) == blobstore.TMPDir
|
||||
}
|
||||
|
||||
func (i *Ignorer) IsRootPath(path string) bool {
|
||||
return path == i.options.Root ||
|
||||
path == i.personalSpacesRoot ||
|
||||
path == i.projectSpacesRoot
|
||||
}
|
||||
|
||||
func (i *Ignorer) IsSpaceRoot(path string) bool {
|
||||
parent := filepath.Dir(path)
|
||||
return parent == i.personalSpacesRoot || parent == i.projectSpacesRoot
|
||||
}
|
||||
|
||||
func (i *Ignorer) IsInternal(path string) bool {
|
||||
return i.IsIndex(path) || strings.Contains(path, lookup.MetadataDir) || i.IsTemporary(path)
|
||||
}
|
||||
|
||||
func IsLockFile(path string) bool {
|
||||
return strings.HasSuffix(path, ".flock") || strings.HasSuffix(path, ".mlock")
|
||||
}
|
||||
|
||||
func IsTrash(path string) bool {
|
||||
return strings.HasSuffix(path, ".trashinfo") || strings.HasSuffix(path, ".trashitem") || strings.Contains(path, ".Trash")
|
||||
}
|
||||
+10
-9
@@ -41,6 +41,7 @@ import (
|
||||
|
||||
"github.com/opencloud-eu/reva/v2/pkg/errtypes"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/events"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/ignore"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/watcher"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/metadata"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/metadata/prefixes"
|
||||
@@ -368,7 +369,7 @@ func (t *Tree) findSpaceId(path string) (string, error) {
|
||||
spaceCandidate := path
|
||||
for strings.HasPrefix(spaceCandidate, t.options.Root) {
|
||||
// jail at root
|
||||
if t.isRootPath(spaceCandidate) {
|
||||
if t.Ignorer.IsRootPath(spaceCandidate) {
|
||||
return "", ErrRootReached
|
||||
}
|
||||
|
||||
@@ -709,7 +710,7 @@ assimilate:
|
||||
// The Space's name attribute might not match the directory name. Use the name as
|
||||
// it was set before. Also the space root doesn't have a 'type' attribute
|
||||
// currently so only set it for normal directories.
|
||||
if t.isSpaceRoot(path) {
|
||||
if t.Ignorer.IsSpaceRoot(path) {
|
||||
if previousAttribs != nil && previousAttribs[prefixes.NameAttr] != nil {
|
||||
attributes[prefixes.NameAttr] = previousAttribs[prefixes.NameAttr]
|
||||
}
|
||||
@@ -866,17 +867,17 @@ func (t *Tree) WarmupIDCache(root string, assimilate, onlyDirty bool) error {
|
||||
}
|
||||
|
||||
// skip irrelevant files
|
||||
if t.isInternal(path) ||
|
||||
isLockFile(path) ||
|
||||
isTrash(path) ||
|
||||
t.isUpload(path) ||
|
||||
t.isIndex(path) {
|
||||
if t.Ignorer.IsInternal(path) ||
|
||||
ignore.IsLockFile(path) ||
|
||||
ignore.IsTrash(path) ||
|
||||
t.Ignorer.IsUpload(path) ||
|
||||
t.Ignorer.IsIndex(path) {
|
||||
if info.IsDir() {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if t.isRootPath(path) {
|
||||
if t.Ignorer.IsRootPath(path) {
|
||||
return nil // ignore the root paths
|
||||
}
|
||||
|
||||
@@ -982,7 +983,7 @@ func (t *Tree) WarmupIDCache(root string, assimilate, onlyDirty bool) error {
|
||||
})
|
||||
|
||||
for dir, size := range sizes {
|
||||
if t.isRootPath(dir) {
|
||||
if t.Ignorer.IsRootPath(dir) {
|
||||
continue
|
||||
}
|
||||
spaceID, id, err := t.lookup.IDsForPath(context.Background(), dir)
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -84,7 +84,7 @@ func (w *CephFSWatcher) Watch(topic string) {
|
||||
continue
|
||||
}
|
||||
|
||||
if w.tree.isIgnored(ev.Path) {
|
||||
if w.tree.Ignorer.IsIgnored(ev.Path) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -83,7 +83,7 @@ start:
|
||||
w.log.Error().Err(err).Str("line", line).Msg("error unmarshalling line")
|
||||
continue
|
||||
}
|
||||
if w.tree.isIgnored(ev.Path) {
|
||||
if w.tree.Ignorer.IsIgnored(ev.Path) {
|
||||
continue
|
||||
}
|
||||
go func() {
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -66,7 +66,7 @@ func (w *GpfsWatchFolderWatcher) Watch(topic string) {
|
||||
continue
|
||||
}
|
||||
|
||||
if w.tree.isIgnored(lwev.Path) {
|
||||
if w.tree.Ignorer.IsIgnored(lwev.Path) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
+7
-63
@@ -41,8 +41,8 @@ import (
|
||||
|
||||
"github.com/opencloud-eu/reva/v2/pkg/errtypes"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/events"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/blobstore"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/idcache"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/ignore"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/lookup"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/options"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/trashbin"
|
||||
@@ -54,7 +54,6 @@ 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"
|
||||
)
|
||||
|
||||
@@ -93,9 +92,8 @@ type Tree struct {
|
||||
idResolver IDResolver // points at the lookup but can be overridden for testing
|
||||
assimilateFunc func(item scanItem) error // function to call to assimilate a node, can be overridden for testing
|
||||
|
||||
options *options.Options
|
||||
personalSpacesRoot string
|
||||
projectSpacesRoot string
|
||||
options *options.Options
|
||||
Ignorer *ignore.Ignorer
|
||||
|
||||
userMapper usermapper.Mapper
|
||||
idCache *idcache.IDCache
|
||||
@@ -128,10 +126,9 @@ 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,
|
||||
personalSpacesRoot: filepath.Clean(filepath.Join(o.Root, templates.Base(o.PersonalSpacePathTemplate))),
|
||||
projectSpacesRoot: filepath.Clean(filepath.Join(o.Root, templates.Base(o.GeneralSpacePathTemplate))),
|
||||
es: es,
|
||||
log: log,
|
||||
Ignorer: ignore.NewIgnorer(o, log),
|
||||
}
|
||||
t.idResolver = t.lookup
|
||||
t.assimilateFunc = t.assimilate
|
||||
@@ -499,7 +496,7 @@ func (t *Tree) ListFolder(ctx context.Context, n *node.Node) ([]*node.Node, erro
|
||||
g.Go(func() error {
|
||||
defer close(work)
|
||||
for _, name := range names {
|
||||
if t.isInternal(name) || isLockFile(name) || isTrash(name) {
|
||||
if t.Ignorer.IsInternal(name) || ignore.IsLockFile(name) || ignore.IsTrash(name) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -776,56 +773,3 @@ func (t *Tree) createDirNode(ctx context.Context, n *node.Node) (err error) {
|
||||
}
|
||||
return n.SetXattrsWithContext(ctx, attributes, false)
|
||||
}
|
||||
|
||||
func (t *Tree) isIgnored(path string) bool {
|
||||
return isLockFile(path) || isTrash(path) || t.isUpload(path) || t.isInternal(path) || t.isRootPath(path) || t.isSpaceRoot(path)
|
||||
}
|
||||
|
||||
func (t *Tree) isUpload(path string) bool {
|
||||
return strings.HasPrefix(path, t.options.UploadDirectory)
|
||||
}
|
||||
|
||||
func (t *Tree) isIndex(path string) bool {
|
||||
return strings.HasPrefix(path, filepath.Join(t.options.Root, "indexes"))
|
||||
}
|
||||
|
||||
func (t *Tree) isTemporary(path string) bool {
|
||||
if filepath.IsAbs(path) {
|
||||
tmpDirPattern := filepath.Join(t.options.Root, "*", "*", blobstore.TMPDir)
|
||||
isTempDir, err := filepath.Match(tmpDirPattern, path)
|
||||
if err != nil {
|
||||
t.log.Error().Err(err).Str("pattern", tmpDirPattern).Str("path", path).Msg("error matching temporary path")
|
||||
return false
|
||||
}
|
||||
isTempParentDir, err := filepath.Match(tmpDirPattern, filepath.Dir(path))
|
||||
if err != nil {
|
||||
t.log.Error().Err(err).Str("pattern", tmpDirPattern).Str("path", filepath.Dir(path)).Msg("error matching temporary path")
|
||||
return false
|
||||
}
|
||||
return isTempDir || isTempParentDir
|
||||
}
|
||||
return path == blobstore.TMPDir || filepath.Dir(path) == blobstore.TMPDir
|
||||
}
|
||||
|
||||
func (t *Tree) isRootPath(path string) bool {
|
||||
return path == t.options.Root ||
|
||||
path == t.personalSpacesRoot ||
|
||||
path == t.projectSpacesRoot
|
||||
}
|
||||
|
||||
func (t *Tree) isSpaceRoot(path string) bool {
|
||||
parent := filepath.Dir(path)
|
||||
return parent == t.personalSpacesRoot || parent == t.projectSpacesRoot
|
||||
}
|
||||
|
||||
func (t *Tree) isInternal(path string) bool {
|
||||
return t.isIndex(path) || strings.Contains(path, lookup.MetadataDir) || t.isTemporary(path)
|
||||
}
|
||||
|
||||
func isLockFile(path string) bool {
|
||||
return strings.HasSuffix(path, ".flock") || strings.HasSuffix(path, ".mlock")
|
||||
}
|
||||
|
||||
func isTrash(path string) bool {
|
||||
return strings.HasSuffix(path, ".trashinfo") || strings.HasSuffix(path, ".trashitem") || strings.Contains(path, ".Trash")
|
||||
}
|
||||
|
||||
Generated
Vendored
+3
-2
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/rs/zerolog"
|
||||
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/ignore"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/options"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/watcher"
|
||||
)
|
||||
@@ -212,8 +213,8 @@ func isSubpath(root, p string) bool {
|
||||
// isIgnored checks if the path is ignored by its tree.
|
||||
func isPathIgnored(tree *Tree, path string) bool {
|
||||
|
||||
isLockFile := isLockFile(path)
|
||||
isTrash := isTrash(path)
|
||||
isLockFile := ignore.IsLockFile(path)
|
||||
isTrash := ignore.IsTrash(path)
|
||||
isUpload := tree.isUpload(path)
|
||||
isInternal := tree.isInternal(path)
|
||||
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -90,7 +90,7 @@ func (iw *InotifyWatcher) Watch(path string) {
|
||||
for {
|
||||
select {
|
||||
case event := <-events:
|
||||
if iw.tree.isIgnored(event.Filename) {
|
||||
if iw.tree.Ignorer.IsIgnored(event.Filename) {
|
||||
continue
|
||||
}
|
||||
for _, e := range event.Events {
|
||||
|
||||
Vendored
+2
-1
@@ -1363,7 +1363,7 @@ github.com/opencloud-eu/icap-client
|
||||
# github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d
|
||||
## explicit; go 1.18
|
||||
github.com/opencloud-eu/libre-graph-api-go
|
||||
# github.com/opencloud-eu/reva/v2 v2.46.0
|
||||
# github.com/opencloud-eu/reva/v2 v2.46.1-0.20260522083006-063ee129f21e
|
||||
## explicit; go 1.25.0
|
||||
github.com/opencloud-eu/reva/v2/cmd/revad/internal/grace
|
||||
github.com/opencloud-eu/reva/v2/cmd/revad/runtime
|
||||
@@ -1651,6 +1651,7 @@ github.com/opencloud-eu/reva/v2/pkg/storage/fs/owncloudsql/filecache
|
||||
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix
|
||||
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/blobstore
|
||||
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/idcache
|
||||
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/ignore
|
||||
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/lookup
|
||||
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/options
|
||||
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/timemanager
|
||||
|
||||
Reference in New Issue
Block a user