mirror of
https://github.com/AlistGo/alist.git
synced 2025-04-21 20:18:47 +08:00
chore(fs): rename some variable and param
This commit is contained in:
parent
f6242d46b1
commit
72208e052a
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user