reva bump (#1555)
This commit is contained in:
+1
@@ -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"`
|
||||
}
|
||||
|
||||
+14
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user