mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-09-29 15:37:39 -04:00
chore: bump reva to 20bd38162f88
Restore the versionID-based antivirus revert in upload.Cleanup and make RevertCurrentRevision/getLatestRevision layout-aware via PathLookup.VersionPath, fixing the posix posixfs @issue-enterprise-5709 antivirus revert regression introduced by the port of owncloud/reva PR #409. Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
1 parent
ab35eee3f7
commit
b5bfb98006
20 files changed
+177
-56
No files matched your search
@@ -13,7 +13,7 @@ require (
|
||||
github.com/beevik/etree v1.8.0
|
||||
github.com/blevesearch/bleve/v2 v2.6.1
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible
|
||||
github.com/coreos/go-oidc/v3 v3.20.0
|
||||
github.com/coreos/go-oidc/v3 v3.21.0
|
||||
github.com/cs3org/go-cs3apis v0.0.0-20260424072047-8d9ef7076ae9
|
||||
github.com/davidbyttow/govips/v2 v2.18.0
|
||||
github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8
|
||||
@@ -64,7 +64,7 @@ require (
|
||||
github.com/open-policy-agent/opa v1.19.1
|
||||
github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89
|
||||
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260902170011-45af3945a067
|
||||
github.com/opencloud-eu/reva/v2 v2.50.1-0.20260924114030-295fe643704f
|
||||
github.com/opencloud-eu/reva/v2 v2.50.1-0.20260928125800-20bd38162f88
|
||||
github.com/opensearch-project/opensearch-go/v4 v4.7.3
|
||||
github.com/orcaman/concurrent-map v1.0.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
@@ -218,7 +218,7 @@ require (
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.2 // indirect
|
||||
github.com/go-redis/redis/v8 v8.11.5 // indirect
|
||||
github.com/go-sql-driver/mysql v1.10.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.10.1 // indirect
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
||||
github.com/go-test/deep v1.1.0 // indirect
|
||||
@@ -228,7 +228,7 @@ require (
|
||||
github.com/gobwas/ws v1.2.1 // indirect
|
||||
github.com/goccy/go-json v0.10.6 // indirect
|
||||
github.com/goccy/go-yaml v1.19.2 // indirect
|
||||
github.com/gofrs/flock v0.13.0 // indirect
|
||||
github.com/gofrs/flock v0.13.1 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
|
||||
github.com/golang/snappy v1.0.0 // indirect
|
||||
|
||||
@@ -234,8 +234,8 @@ github.com/containerd/platforms v1.0.0-rc.2 h1:0SPgaNZPVWGEi4grZdV8VRYQn78y+nm6a
|
||||
github.com/containerd/platforms v1.0.0-rc.2/go.mod h1:J71L7B+aiM5SdIEqmd9wp6THLVRzJGXfNuWCZCllLA4=
|
||||
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
|
||||
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/go-oidc/v3 v3.20.0 h1:EtE0WIBHk03N+DqGkY4+UONzzZHk7amKt6IyNd7OsZE=
|
||||
github.com/coreos/go-oidc/v3 v3.20.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4=
|
||||
github.com/coreos/go-oidc/v3 v3.21.0 h1:wZo4Q9Pum8dYEj0eMUPrqR+kvuGkeUplbLpNCkBqoWM=
|
||||
github.com/coreos/go-oidc/v3 v3.21.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4=
|
||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
|
||||
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
|
||||
@@ -446,8 +446,8 @@ github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq
|
||||
github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8=
|
||||
github.com/go-resty/resty/v2 v2.17.2 h1:FQW5oHYcIlkCNrMD2lloGScxcHJ0gkjshV3qcQAyHQk=
|
||||
github.com/go-resty/resty/v2 v2.17.2/go.mod h1:kCKZ3wWmwJaNc7S29BRtUhJwy7iqmn+2mLtQrOyQlVA=
|
||||
github.com/go-sql-driver/mysql v1.10.0 h1:Q+1LV8DkHJvSYAdR83XzuhDaTykuDx0l6fkXxoWCWfw=
|
||||
github.com/go-sql-driver/mysql v1.10.0/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk=
|
||||
github.com/go-sql-driver/mysql v1.10.1 h1:arlSnNLq6a5yxGxV7qg9lF4j0C+KwD6NbQyKr9QL6ME=
|
||||
github.com/go-sql-driver/mysql v1.10.1/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
|
||||
@@ -471,8 +471,8 @@ github.com/goccy/go-json v0.10.6 h1:p8HrPJzOakx/mn/bQtjgNjdTcN+/S6FcG2CTtQOrHVU=
|
||||
github.com/goccy/go-json v0.10.6/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
|
||||
github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
|
||||
github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw=
|
||||
github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0=
|
||||
github.com/gofrs/flock v0.13.1 h1:jjREztyBeSKBZYAC+mgc1laB+xsgy4kYMf3FbKF2UBo=
|
||||
github.com/gofrs/flock v0.13.1/go.mod h1:sf4BFiHwnvgxa25DlQoDqXQnwRMEOwqxRq37P6MzzmE=
|
||||
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
@@ -930,8 +930,8 @@ github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89 h1:W1ms+l
|
||||
github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89/go.mod h1:vigJkNss1N2QEceCuNw/ullDehncuJNFB6mEnzfq9UI=
|
||||
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260902170011-45af3945a067 h1:UkNMKauyJAzY6RE6mmthz9bQZLYkbvBuApm7ZDCparE=
|
||||
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260902170011-45af3945a067/go.mod h1:lTM8JeGblNpoMySTW7Lui2+c5TTLI95mwxtdUIHHrhU=
|
||||
github.com/opencloud-eu/reva/v2 v2.50.1-0.20260924114030-295fe643704f h1:60BWWuYRUkLhcdyto+5/sKnWx85F0VtS/VWxK9w4V+0=
|
||||
github.com/opencloud-eu/reva/v2 v2.50.1-0.20260924114030-295fe643704f/go.mod h1:UnhCBGqcuhLkOhrmvbEsiBaDiD5uDGzaylnoc+QzJNs=
|
||||
github.com/opencloud-eu/reva/v2 v2.50.1-0.20260928125800-20bd38162f88 h1:hKiTQhKv8U9VGtczcMZckKJupdS0dqUu9iChcdbstX0=
|
||||
github.com/opencloud-eu/reva/v2 v2.50.1-0.20260928125800-20bd38162f88/go.mod h1:P7c7AhaazP/ERHgd51hyLhiGpdpCcVjKCImQNhtfHYU=
|
||||
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=
|
||||
|
||||
+14
@@ -278,6 +278,20 @@ func (j *jwkJSON) UnmarshalJSON(data []byte) error {
|
||||
}
|
||||
var jwk jose.JSONWebKey
|
||||
if err := json.Unmarshal(key, &jwk); err != nil {
|
||||
// Ignore keys with types that go-jose doesn't support, such as
|
||||
// OKP keys with Ed448 or X448 curves. Some providers include
|
||||
// them in their key sets without an "alg" value, so the check
|
||||
// above doesn't catch them.
|
||||
//
|
||||
// https://datatracker.ietf.org/doc/html/rfc7517#section-5
|
||||
//
|
||||
// Implementations SHOULD ignore JWKs within a JWK Set that use
|
||||
// "kty" (key type) values that are not understood by them, that
|
||||
// are missing required members, or for which values are out of
|
||||
// the supported ranges.
|
||||
if errors.Is(err, jose.ErrUnsupportedKeyType) {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
j.Keys = append(j.Keys, jwk)
|
||||
|
||||
+1
@@ -129,6 +129,7 @@ Xiangyu Hu <xiangyu.hu at outlook.com>
|
||||
Xiaobing Jiang <s7v7nislands at gmail.com>
|
||||
Xiuming Chen <cc at cxm.cc>
|
||||
Xuehong Chan <chanxuehong at gmail.com>
|
||||
Yoshito Ohata <yoshito.dev at gmail.com>
|
||||
Zhang Xiang <angwerzx at 126.com>
|
||||
Zhenye Xie <xiezhenye at gmail.com>
|
||||
Zhixin Wen <john.wenzhixin at gmail.com>
|
||||
|
||||
+10
@@ -1,5 +1,15 @@
|
||||
# Changelog
|
||||
|
||||
## v1.10.1 (2026-09-02)
|
||||
|
||||
* Fix `Config.FormatDSN()` dropping `Addr` when `Net` is empty.
|
||||
It now uses the default `tcp` network so configs with only `Addr` round-trip correctly. (#1770)
|
||||
|
||||
* Fix typed-nil `json.RawMessage` with `interpolateParams=true` being interpolated as an empty string.
|
||||
It is now interpolated as SQL `NULL`, matching server-side prepared statements. (#1782)
|
||||
|
||||
* Add MariaDB 11.8 and 12.3 to the test matrix. (#1774)
|
||||
|
||||
## v1.10.0 (2026-04-28)
|
||||
|
||||
* Fix `getSystemVar("max_allowed_packet")` potentially returned wrong value. (#1754)
|
||||
|
||||
+4
-1
@@ -314,7 +314,10 @@ Type: duration
|
||||
Default: 0
|
||||
```
|
||||
|
||||
[Truncate time values](https://pkg.go.dev/time#Duration.Truncate) to the specified duration. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
|
||||
[Truncate time values](https://pkg.go.dev/time#Duration.Truncate) in query arguments to the specified duration. The value must be a decimal number with a unit suffix (*"ns"*, *"us"*, *"ms"*, etc...), such as "1us", "1ms", or "10ns".
|
||||
|
||||
> [!NOTE]
|
||||
> `time.Time` arguments are sent with up to nanosecond precision, so a value from `time.Now()` usually has more fractional-second digits than a `DATETIME(N)` or `TIMESTAMP(N)` column stores. On MariaDB, comparing such a value against an indexed column can prevent an index range scan, turning it into a full index scan. Truncating to the column's precision (`1us` for `DATETIME(6)`) avoids this. Only arguments sent to the server are truncated; values read from the server are not affected.
|
||||
|
||||
##### `maxAllowedPacket`
|
||||
```
|
||||
|
||||
+3
-1
@@ -384,7 +384,9 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin
|
||||
buf = append(buf, '\'')
|
||||
}
|
||||
case json.RawMessage:
|
||||
if noBackslashEscapes {
|
||||
if v == nil {
|
||||
buf = append(buf, "NULL"...)
|
||||
} else if noBackslashEscapes {
|
||||
buf = escapeBytesQuotes(buf, v, false)
|
||||
} else {
|
||||
buf = escapeBytesBackslash(buf, v, false)
|
||||
|
||||
+12
-6
@@ -264,13 +264,19 @@ func (cfg *Config) FormatDSN() string {
|
||||
}
|
||||
|
||||
// [protocol[(address)]]
|
||||
if len(cfg.Net) > 0 {
|
||||
buf.WriteString(cfg.Net)
|
||||
if len(cfg.Addr) > 0 {
|
||||
buf.WriteByte('(')
|
||||
buf.WriteString(cfg.Addr)
|
||||
buf.WriteByte(')')
|
||||
if len(cfg.Addr) > 0 {
|
||||
net := cfg.Net
|
||||
if net == "" {
|
||||
net = "tcp"
|
||||
}
|
||||
buf.WriteString(net)
|
||||
buf.WriteByte('(')
|
||||
buf.WriteString(cfg.Addr)
|
||||
buf.WriteByte(')')
|
||||
} else if cfg.Net != "" && cfg.Net != "tcp" {
|
||||
// Preserve an explicit non-default protocol when there's no
|
||||
// address, so e.g. Net="unix" still round-trips.
|
||||
buf.WriteString(cfg.Net)
|
||||
}
|
||||
|
||||
// /dbname
|
||||
|
||||
+3
-1
@@ -6,7 +6,9 @@ formatters:
|
||||
- goimports
|
||||
settings:
|
||||
gofumpt:
|
||||
extra-rules: true
|
||||
extra:
|
||||
clothe-returns: true
|
||||
group-params: true
|
||||
|
||||
linters:
|
||||
enable:
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
// Copyright 2015 Tim Heckman. All rights reserved.
|
||||
// Copyright 2018-2025 The Gofrs. All rights reserved.
|
||||
// Copyright 2018-2026 The Gofrs. All rights reserved.
|
||||
// Use of this source code is governed by the BSD 3-Clause
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
@@ -100,7 +100,7 @@ func (f *Flock) Close() error {
|
||||
return f.Unlock()
|
||||
}
|
||||
|
||||
// Path returns the path as provided in NewFlock().
|
||||
// Path returns the path as provided in New().
|
||||
func (f *Flock) Path() string {
|
||||
return f.path
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// Copyright 2015 Tim Heckman. All rights reserved.
|
||||
// Copyright 2018-2025 The Gofrs. All rights reserved.
|
||||
// Copyright 2018-2026 The Gofrs. All rights reserved.
|
||||
// Use of this source code is governed by the BSD 3-Clause
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// Copyright 2015 Tim Heckman. All rights reserved.
|
||||
// Copyright 2018-2025 The Gofrs. All rights reserved.
|
||||
// Copyright 2018-2026 The Gofrs. All rights reserved.
|
||||
// Use of this source code is governed by the BSD 3-Clause
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// Copyright 2015 Tim Heckman. All rights reserved.
|
||||
// Copyright 2018-2025 The Gofrs. All rights reserved.
|
||||
// Copyright 2018-2026 The Gofrs. All rights reserved.
|
||||
// Use of this source code is governed by the BSD 3-Clause
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// Copyright 2015 Tim Heckman. All rights reserved.
|
||||
// Copyright 2018-2025 The Gofrs. All rights reserved.
|
||||
// Copyright 2018-2026 The Gofrs. All rights reserved.
|
||||
// Use of this source code is governed by the BSD 3-Clause
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
rules:
|
||||
secrets-outside-env:
|
||||
disable: true
|
||||
+20
-5
@@ -66,8 +66,10 @@ func (fs *Decomposedfs) SetArbitraryMetadata(ctx context.Context, ref *provider.
|
||||
|
||||
errs := []error{}
|
||||
// TODO should we really continue updating when an error occurs?
|
||||
changed := false
|
||||
if md.Metadata != nil {
|
||||
if val, ok := md.Metadata["mtime"]; ok {
|
||||
changed = true
|
||||
delete(md.Metadata, "mtime")
|
||||
if err := n.SetMtimeString(ctx, val); err != nil {
|
||||
errs = append(errs, errors.Wrap(err, "could not set mtime"))
|
||||
@@ -79,27 +81,40 @@ func (fs *Decomposedfs) SetArbitraryMetadata(ctx context.Context, ref *provider.
|
||||
// TODO unset when file is updated
|
||||
// TODO unset when folder is updated or add timestamp to etag?
|
||||
if val, ok := md.Metadata["etag"]; ok {
|
||||
changed = true
|
||||
delete(md.Metadata, "etag")
|
||||
if err := n.SetEtag(ctx, val); err != nil {
|
||||
errs = append(errs, errors.Wrap(err, "could not set etag"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// one write for the whole set: a per key write publishes every intermediate
|
||||
// state to the unlocked, cache first readers
|
||||
if len(md.Metadata) > 0 {
|
||||
attribs := make(map[string][]byte, len(md.Metadata))
|
||||
for k, v := range md.Metadata {
|
||||
attribs[prefixes.MetadataPrefix+k] = []byte(v)
|
||||
attribs := make(map[string][]byte, len(md.Metadata))
|
||||
existingAttribs, err := n.Xattrs(ctx)
|
||||
for k, v := range md.Metadata {
|
||||
if existingVal, ok := existingAttribs[prefixes.MetadataPrefix+k]; ok && string(existingVal) == v {
|
||||
continue // no change needed
|
||||
}
|
||||
changed = true
|
||||
attribs[prefixes.MetadataPrefix+k] = []byte(v)
|
||||
}
|
||||
if len(attribs) > 0 {
|
||||
if err = n.SetXattrsWithContext(ctx, attribs); err != nil {
|
||||
errs = append(errs, errors.Wrap(err, "Decomposedfs: could not set metadata attributes"))
|
||||
}
|
||||
}
|
||||
|
||||
if changed {
|
||||
if err = fs.tp.Propagate(ctx, n, 0); err != nil {
|
||||
errs = append(errs, errors.Wrap(err, "Decomposedfs: could not propagate metadata changes"))
|
||||
}
|
||||
}
|
||||
|
||||
switch len(errs) {
|
||||
case 0:
|
||||
return fs.tp.Propagate(ctx, n, 0)
|
||||
return nil
|
||||
case 1:
|
||||
// TODO Propagate if anything changed
|
||||
return errs[0]
|
||||
|
||||
Generated
Vendored
+20
@@ -94,6 +94,26 @@ func (n *Node) ReadLock(ctx context.Context, skipFileLock bool) (*provider.Lock,
|
||||
ctx, span := tracer.Start(ctx, "ReadLock")
|
||||
defer span.End()
|
||||
|
||||
// Fast path: application locks almost never exist. Acquiring a file lock
|
||||
// creates a .flock sibling next to the node, which bumps the parent
|
||||
// directory's mtime and churns etags on every read. So if there is no lock
|
||||
// file to read, bail out before taking any file lock (and before the
|
||||
// MkdirAll), avoiding those side effects entirely.
|
||||
if !skipFileLock {
|
||||
_, subspan := tracer.Start(ctx, "os.Stat")
|
||||
found := false
|
||||
for _, p := range n.LockFilePaths() {
|
||||
if _, serr := os.Stat(p); serr == nil {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
subspan.End()
|
||||
if !found {
|
||||
return nil, errtypes.NotFound("no lock found")
|
||||
}
|
||||
}
|
||||
|
||||
// ensure parent path exists
|
||||
_, subspan := tracer.Start(ctx, "os.MkdirAll")
|
||||
err := os.MkdirAll(filepath.Dir(n.InternalPath()), 0700)
|
||||
|
||||
+3
-3
@@ -1572,7 +1572,7 @@ func (n *Node) RevertCurrentRevision(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
revisionID := strings.TrimPrefix(versionPath, n.InternalPath()+RevisionIDDelimiter)
|
||||
revisionID := strings.TrimPrefix(versionPath, n.lu.VersionPath(n.SpaceID, n.ID, ""))
|
||||
versionNode := NewBaseNode(n.SpaceID, n.ID+RevisionIDDelimiter+revisionID, n.lu)
|
||||
if err := n.lu.CopyMetadata(ctx, versionNode, n, func(attributeName string, value []byte) (newValue []byte, copy bool) {
|
||||
return value, strings.HasPrefix(attributeName, prefixes.ChecksumPrefix) ||
|
||||
@@ -1601,8 +1601,8 @@ func (n *Node) RevertCurrentRevision(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (n *Node) getLatestRevision(ctx context.Context) (string, error) {
|
||||
revPrefix := n.InternalPath() + RevisionIDDelimiter
|
||||
revisions, err := filepath.Glob(revPrefix + "*")
|
||||
revPrefix := n.lu.VersionPath(n.SpaceID, n.ID, "")
|
||||
revisions, err := filepath.Glob(n.lu.VersionPath(n.SpaceID, n.ID, "*"))
|
||||
if err != nil {
|
||||
appctx.GetLogger(ctx).Error().Str("nodepath", n.InternalPath()).Err(err).Msg("error reading revisions")
|
||||
return "", err
|
||||
|
||||
Generated
Vendored
+61
-16
@@ -433,12 +433,72 @@ func checkHash(expected string, h hash.Hash) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (session *DecomposedFsSession) removeNode(ctx context.Context) {
|
||||
n, err := session.Node(ctx)
|
||||
if err != nil {
|
||||
appctx.GetLogger(ctx).Error().Str("session", session.ID()).Err(err).Msg("getting node from session failed")
|
||||
return
|
||||
}
|
||||
if err := n.Purge(ctx); err != nil {
|
||||
appctx.GetLogger(ctx).Error().Str("nodepath", n.InternalPath()).Err(err).Msg("purging node failed")
|
||||
}
|
||||
}
|
||||
|
||||
// cleanup cleans up after the upload is finished
|
||||
func (session *DecomposedFsSession) Cleanup(revertNodeMetadata, cleanBin, cleanInfo, unmarkPostprocessing bool) {
|
||||
ctx := session.Context(context.Background())
|
||||
sublog := session.store.log.With().Str("cleanup sessionid", session.ID()).Bool("revertNodeMetadata", revertNodeMetadata).Bool("cleanBin", cleanBin).
|
||||
Bool("cleanInfo", cleanInfo).Bool("unmarkPostprocessing", unmarkPostprocessing).Logger()
|
||||
|
||||
if revertNodeMetadata {
|
||||
n, err := session.Node(ctx)
|
||||
if err != nil {
|
||||
sublog.Error().Err(err).Msg("reading node for session failed")
|
||||
} else {
|
||||
if session.NodeExists() && session.info.MetaData["versionID"] != "" {
|
||||
versionID := session.info.MetaData["versionID"]
|
||||
sublog.Debug().Str("nodepath", n.InternalPath()).Str("versionID", versionID).Msg("restoring revision")
|
||||
revisionNode, err := node.ReadNode(ctx, session.store.lu, session.SpaceID(), versionID, "", false, n.SpaceRoot, false)
|
||||
if err != nil {
|
||||
sublog.Error().Err(err).Str("versionID", versionID).Msg("reading revision node failed")
|
||||
return
|
||||
}
|
||||
|
||||
if !revisionNode.Exists {
|
||||
sublog.Error().Str("versionID", versionID).Msg("revision node does not exist")
|
||||
return
|
||||
}
|
||||
|
||||
// restore the revision
|
||||
mtime, err := revisionNode.GetMTime(ctx)
|
||||
if err != nil {
|
||||
sublog.Error().Err(err).Str("versionID", versionID).Msg("getting mtime of revision node failed")
|
||||
mtime = time.Now()
|
||||
}
|
||||
|
||||
if err := session.store.tp.RestoreRevision(ctx, revisionNode, n, mtime); err != nil {
|
||||
sublog.Error().Err(err).Str("versionID", versionID).Msg("restoring revision node failed")
|
||||
return
|
||||
}
|
||||
|
||||
if err := os.RemoveAll(revisionNode.InternalPath()); err != nil {
|
||||
sublog.Error().Err(err).Str("revisionpath", revisionNode.InternalPath()).Msg("removing restored revision file failed")
|
||||
}
|
||||
} else {
|
||||
// if no other upload session is in progress (processing id != session id) or has finished (processing id == "")
|
||||
latestSession, err := n.ProcessingID(ctx)
|
||||
if err != nil {
|
||||
sublog.Error().Err(err).Str("spaceid", n.SpaceID).Str("nodeid", n.ID).Str("uploadid", session.ID()).Msg("reading processingid for session failed")
|
||||
}
|
||||
if latestSession == session.ID() {
|
||||
// actually delete the node
|
||||
session.removeNode(ctx)
|
||||
}
|
||||
// FIXME else if the upload has become a revision, delete the revision, or if it is the last one, delete the node
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if cleanBin {
|
||||
if err := os.Remove(session.binPath()); err != nil && !errors.Is(err, fs.ErrNotExist) {
|
||||
appctx.GetLogger(ctx).Error().Str("path", session.binPath()).Err(err).Msg("removing upload failed")
|
||||
@@ -448,26 +508,11 @@ func (session *DecomposedFsSession) Cleanup(revertNodeMetadata, cleanBin, cleanI
|
||||
if cleanInfo {
|
||||
if err := os.Remove(session.infoPath()); err != nil {
|
||||
sublog.Error().Err(err).Msg("removing upload info failed")
|
||||
}
|
||||
}
|
||||
|
||||
if revertNodeMetadata {
|
||||
n, err := session.Node(ctx)
|
||||
if err != nil {
|
||||
sublog.Error().Err(err).Msg("reading node for session failed")
|
||||
return
|
||||
}
|
||||
|
||||
curUpload, err := n.ProcessingID(ctx)
|
||||
if err == nil && curUpload == session.ID() {
|
||||
if err := n.RevertCurrentRevision(ctx); err != nil {
|
||||
sublog.Error().Err(err).Str("nodepath", n.InternalPath()).Msg("reverting node metadata failed")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if unmarkPostprocessing && !revertNodeMetadata { // node reverting automatically unmarks processing
|
||||
if unmarkPostprocessing {
|
||||
n, err := session.Node(ctx)
|
||||
if err != nil {
|
||||
sublog.Info().Err(err).Msg("could not read node")
|
||||
|
||||
Vendored
+5
-5
@@ -280,7 +280,7 @@ github.com/containerd/log
|
||||
# github.com/containerd/platforms v1.0.0-rc.2
|
||||
## explicit; go 1.20
|
||||
github.com/containerd/platforms
|
||||
# github.com/coreos/go-oidc/v3 v3.20.0
|
||||
# github.com/coreos/go-oidc/v3 v3.21.0
|
||||
## explicit; go 1.25.0
|
||||
github.com/coreos/go-oidc/v3/oidc
|
||||
# github.com/coreos/go-semver v0.3.1
|
||||
@@ -599,7 +599,7 @@ github.com/go-redis/redis/v8/internal/util
|
||||
## explicit; go 1.23.0
|
||||
github.com/go-resty/resty/v2
|
||||
github.com/go-resty/resty/v2/shellescape
|
||||
# github.com/go-sql-driver/mysql v1.10.0
|
||||
# github.com/go-sql-driver/mysql v1.10.1
|
||||
## explicit; go 1.24.0
|
||||
github.com/go-sql-driver/mysql
|
||||
# github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572
|
||||
@@ -659,8 +659,8 @@ github.com/goccy/go-yaml/parser
|
||||
github.com/goccy/go-yaml/printer
|
||||
github.com/goccy/go-yaml/scanner
|
||||
github.com/goccy/go-yaml/token
|
||||
# github.com/gofrs/flock v0.13.0
|
||||
## explicit; go 1.24.0
|
||||
# github.com/gofrs/flock v0.13.1
|
||||
## explicit; go 1.25.0
|
||||
github.com/gofrs/flock
|
||||
# github.com/golang-jwt/jwt/v4 v4.5.2
|
||||
## explicit; go 1.16
|
||||
@@ -1338,7 +1338,7 @@ github.com/opencloud-eu/icap-client
|
||||
# github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260902170011-45af3945a067
|
||||
## explicit; go 1.23
|
||||
github.com/opencloud-eu/libre-graph-api-go
|
||||
# github.com/opencloud-eu/reva/v2 v2.50.1-0.20260924114030-295fe643704f
|
||||
# github.com/opencloud-eu/reva/v2 v2.50.1-0.20260928125800-20bd38162f88
|
||||
## explicit; go 1.26.0
|
||||
github.com/opencloud-eu/reva/v2/cmd/revad/internal/grace
|
||||
github.com/opencloud-eu/reva/v2/cmd/revad/runtime
|
||||
|
||||
Reference in new issue
Block a user