This commit is contained in:
Viktor Scharf
2025-09-24 18:06:33 +02:00
committed by GitHub
parent a2f4106bca
commit 59bc215f96
5 changed files with 19 additions and 5 deletions

2
go.mod
View File

@@ -65,7 +65,7 @@ require (
github.com/onsi/gomega v1.38.2
github.com/open-policy-agent/opa v1.8.0
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76
github.com/opencloud-eu/reva/v2 v2.38.1-0.20250922152322-476bb1f0070a
github.com/opencloud-eu/reva/v2 v2.38.1-0.20250924125540-eaa2437c36b2
github.com/opensearch-project/opensearch-go/v4 v4.5.0
github.com/orcaman/concurrent-map v1.0.0
github.com/pkg/errors v0.9.1

4
go.sum
View File

@@ -930,8 +930,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.20250724122329-41ba6b191e76 h1:vD/EdfDUrv4omSFjrinT8Mvf+8D7f9g4vgQ2oiDrVUI=
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q=
github.com/opencloud-eu/reva/v2 v2.38.1-0.20250922152322-476bb1f0070a h1:LwqYIxoBH26sWdk2xHzgEdWlqVnQJ2lC8MuwBMjkuC0=
github.com/opencloud-eu/reva/v2 v2.38.1-0.20250922152322-476bb1f0070a/go.mod h1:jykpTTQ0QWw0EzLop+6neuKCPccE0rj2asOwzls283U=
github.com/opencloud-eu/reva/v2 v2.38.1-0.20250924125540-eaa2437c36b2 h1:e3B6KbWMjloKpqoTwTwvBLoCETRyyCDkQsqwRQMUdxc=
github.com/opencloud-eu/reva/v2 v2.38.1-0.20250924125540-eaa2437c36b2/go.mod h1:8mGCM9tLIPsC5aEKS022Z5u89u6jKuOl0znK0gNFReM=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=

View File

@@ -106,6 +106,7 @@ type CapabilitiesCore struct {
PollInterval int `json:"pollinterval" xml:"pollinterval" mapstructure:"poll_interval"`
WebdavRoot string `json:"webdav-root,omitempty" xml:"webdav-root,omitempty" mapstructure:"webdav_root"`
Status *Status `json:"status" xml:"status"`
CheckForUpdates ocsBool `json:"check-for-updates" xml:"check-for-updates" mapstructure:"check_for_updates"`
SupportURLSigning ocsBool `json:"support-url-signing" xml:"support-url-signing" mapstructure:"support_url_signing"`
SupportSSE ocsBool `json:"support-sse" xml:"support-sse" mapstructure:"support_sse"`
}

View File

@@ -21,6 +21,7 @@ package tree
import (
"context"
"crypto/sha256"
"fmt"
"io"
"io/fs"
@@ -393,6 +394,17 @@ func (t *Tree) findSpaceId(path string) (string, error) {
return "", fmt.Errorf("could not find space for path %s", path)
}
func (t *Tree) generateTempNodeId(path string) string {
if len(path) < 240 {
return strings.ReplaceAll(strings.TrimPrefix(path, "/"), "/", "-")
} else {
// Use sha256 if path too long
pathHash := fmt.Sprintf("%x", sha256.Sum256([]byte(path)))[:240]
t.log.Info().Str("path", path).Msg("path too long, using sha256 as lock: " + pathHash)
return pathHash
}
}
func (t *Tree) assimilate(item scanItem) error {
t.log.Debug().Str("path", item.Path).Bool("recurse", item.Recurse).Msg("assimilate")
var err error
@@ -532,7 +544,8 @@ func (t *Tree) assimilate(item scanItem) error {
assimilationNode := &assimilationNode{
spaceID: spaceID,
// Use the path as the node ID (which is used for calculating the lock file path) since we do not have an ID yet
nodeId: strings.ReplaceAll(strings.TrimPrefix(item.Path, "/"), "/", "-"),
// In the case path is too long, we do sha256 and extract first 240 characters
nodeId: t.generateTempNodeId(item.Path),
}
unlock, err := t.lookup.MetadataBackend().Lock(assimilationNode)
if err != nil {

2
vendor/modules.txt vendored
View File

@@ -1319,7 +1319,7 @@ github.com/open-policy-agent/opa/v1/version
# github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76
## explicit; go 1.18
github.com/opencloud-eu/libre-graph-api-go
# github.com/opencloud-eu/reva/v2 v2.38.1-0.20250922152322-476bb1f0070a
# github.com/opencloud-eu/reva/v2 v2.38.1-0.20250924125540-eaa2437c36b2
## explicit; go 1.24.1
github.com/opencloud-eu/reva/v2/cmd/revad/internal/grace
github.com/opencloud-eu/reva/v2/cmd/revad/runtime