diff --git a/internal/fs/put.go b/internal/fs/put.go index 7c9589df..0581723e 100644 --- a/internal/fs/put.go +++ b/internal/fs/put.go @@ -16,8 +16,8 @@ var UploadTaskManager = task.NewTaskManager[uint64, struct{}](3, func(tid *uint6 }) // Put add as a put task -func Put(ctx context.Context, account driver.Driver, parentPath string, file model.FileStreamer) error { - account, actualParentPath, err := operations.GetAccountAndActualPath(parentPath) +func Put(ctx context.Context, account driver.Driver, dstDirPath string, file model.FileStreamer) error { + account, dstDirActualPath, err := operations.GetAccountAndActualPath(dstDirPath) if account.Config().NoUpload { return errors.WithStack(ErrUploadNotSupported) } @@ -25,9 +25,9 @@ func Put(ctx context.Context, account driver.Driver, parentPath string, file mod return errors.WithMessage(err, "failed get account") } UploadTaskManager.Submit(task.WithCancelCtx(&task.Task[uint64, struct{}]{ - Name: fmt.Sprintf("upload %s to [%s](%s)", file.GetName(), account.GetAccount().VirtualPath, actualParentPath), + Name: fmt.Sprintf("upload %s to [%s](%s)", file.GetName(), account.GetAccount().VirtualPath, dstDirActualPath), Func: func(task *task.Task[uint64, struct{}]) error { - return operations.Put(task.Ctx, account, actualParentPath, file, nil) + return operations.Put(task.Ctx, account, dstDirActualPath, file, nil) }, })) return nil diff --git a/internal/fs/write.go b/internal/fs/write.go index f67d0a8d..6e060dd7 100644 --- a/internal/fs/write.go +++ b/internal/fs/write.go @@ -20,14 +20,14 @@ func Move(ctx context.Context, account driver.Driver, srcPath, dstDirPath string if err != nil { return errors.WithMessage(err, "failed get src account") } - dstAccount, dstActualPath, err := operations.GetAccountAndActualPath(dstDirPath) + dstAccount, dstDirActualPath, err := operations.GetAccountAndActualPath(dstDirPath) if err != nil { return errors.WithMessage(err, "failed get dst account") } if srcAccount.GetAccount() != dstAccount.GetAccount() { return errors.WithStack(ErrMoveBetweenTwoAccounts) } - return operations.Move(ctx, account, srcActualPath, dstActualPath) + return operations.Move(ctx, account, srcActualPath, dstDirActualPath) } func Rename(ctx context.Context, account driver.Driver, srcPath, dstName string) error { diff --git a/internal/operations/fs.go b/internal/operations/fs.go index 3e999aee..39d2a96b 100644 --- a/internal/operations/fs.go +++ b/internal/operations/fs.go @@ -187,15 +187,15 @@ func Remove(ctx context.Context, account driver.Driver, path string) error { return account.Remove(ctx, obj) } -func Put(ctx context.Context, account driver.Driver, parentPath string, file model.FileStreamer, up driver.UpdateProgress) error { - err := MakeDir(ctx, account, parentPath) +func Put(ctx context.Context, account driver.Driver, dstDirPath string, file model.FileStreamer, up driver.UpdateProgress) error { + err := MakeDir(ctx, account, dstDirPath) if err != nil { - return errors.WithMessagef(err, "failed to make dir [%s]", parentPath) + return errors.WithMessagef(err, "failed to make dir [%s]", dstDirPath) } - parentDir, err := Get(ctx, account, parentPath) + parentDir, err := Get(ctx, account, dstDirPath) // this should not happen if err != nil { - return errors.WithMessagef(err, "failed to get dir [%s]", parentPath) + return errors.WithMessagef(err, "failed to get dir [%s]", dstDirPath) } // if up is nil, set a default to prevent panic if up == nil {