chore: update Go version to 1.26.5 and improve error handling in remote client

master
Aaron Liu 1 week ago
parent 20c95ad73f
commit 65f8c3f3ed

@ -3,7 +3,7 @@ trigger:
include:
- '*'
variables:
GO_VERSION: "1.25.5"
GO_VERSION: "1.26.5"
NODE_VERSION: "22.x"
DOCKER_BUILDKIT: 1

@ -1,8 +1,8 @@
module github.com/cloudreve/Cloudreve/v4
go 1.25.0
go 1.26.0
toolchain go1.25.5
toolchain go1.26.5
require (
entgo.io/ent v0.13.0

@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
@ -177,7 +178,7 @@ func (c *remoteClient) DeleteFiles(ctx context.Context, files ...string) ([]stri
if resp.Code == serializer.CodeNotFullySuccess {
resp.GobDecode(&failed)
}
return failed, fmt.Errorf(resp.Error)
return failed, errors.New(resp.Error)
}
return nil, nil
@ -196,7 +197,7 @@ func (c *remoteClient) MediaMeta(ctx context.Context, src, ext, language string)
}
if resp.Code != 0 {
return nil, fmt.Errorf(resp.Error)
return nil, errors.New(resp.Error)
}
var metas []driver.MediaMeta

@ -764,7 +764,7 @@ func (f *DBFS) getNavigator(ctx context.Context, path *fs.URI, requiredCapabilit
capabilities := res.Capabilities(false).Capability
for _, capability := range requiredCapabilities {
if !capabilities.Enabled(int(capability)) {
return nil, fs.ErrNotSupportedAction.WithError(fmt.Errorf("action %q is not supported under current fs", capability))
return nil, fs.ErrNotSupportedAction.WithError(fmt.Errorf("action %v is not supported under current fs", capability))
}
}

@ -319,7 +319,7 @@ func lockTupleFromUri(uri *fs.URI, u *ent.User, hasher hashid.Encoder) (string,
if id == "" {
id = strconv.Itoa(u.ID)
}
ns := fmt.Sprintf(id + "/" + string(uri.FileSystem()))
ns := id + "/" + string(uri.FileSystem())
root := uri.Path()
return ns, root, ns + "/" + root
}

@ -54,7 +54,7 @@ func (f *DBFS) Create(ctx context.Context, path *fs.URI, fileType types.FileType
// File with the same name but different type already exist
return nil, fs.ErrFileExisted.
WithError(fmt.Errorf("object with the same name but different type %q already exist", ancestor.Type()))
WithError(fmt.Errorf("object with the same name but different type %v already exist", ancestor.Type()))
}
if _, ok := ctx.Value(ByPassOwnerCheckCtxKey{}).(bool); !ok && ancestor.Owner().ID != f.user.ID {

Loading…
Cancel
Save