feat: file proxy handle
This commit is contained in:
@ -85,7 +85,7 @@ func copyFileBetween2Accounts(tsk *task.Task[uint64], srcAccount, dstAccount dri
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "failed get src [%s] file", srcFilePath)
|
||||
}
|
||||
link, err := operations.Link(tsk.Ctx, srcAccount, srcFilePath, model.LinkArgs{})
|
||||
link, _, err := operations.Link(tsk.Ctx, srcAccount, srcFilePath, model.LinkArgs{})
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "failed get [%s] link", srcFilePath)
|
||||
}
|
||||
|
@ -30,13 +30,13 @@ func Get(ctx context.Context, path string) (model.Obj, error) {
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func Link(ctx context.Context, path string, args model.LinkArgs) (*model.Link, error) {
|
||||
res, err := link(ctx, path, args)
|
||||
func Link(ctx context.Context, path string, args model.LinkArgs) (*model.Link, model.Obj, error) {
|
||||
res, file, err := link(ctx, path, args)
|
||||
if err != nil {
|
||||
log.Errorf("failed link %s: %+v", path, err)
|
||||
return nil, err
|
||||
return nil, nil, err
|
||||
}
|
||||
return res, nil
|
||||
return res, file, nil
|
||||
}
|
||||
|
||||
func MakeDir(ctx context.Context, path string) error {
|
||||
|
@ -7,10 +7,10 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func link(ctx context.Context, path string, args model.LinkArgs) (*model.Link, error) {
|
||||
func link(ctx context.Context, path string, args model.LinkArgs) (*model.Link, model.Obj, error) {
|
||||
account, actualPath, err := operations.GetAccountAndActualPath(path)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "failed get account")
|
||||
return nil, nil, errors.WithMessage(err, "failed get account")
|
||||
}
|
||||
return operations.Link(ctx, account, actualPath, args)
|
||||
}
|
||||
|
Reference in New Issue
Block a user