feat(webdav): support copy directly without task (close #5206)

This commit is contained in:
Andy Hsu
2023-09-13 15:45:57 +08:00
parent 109015567a
commit 352a6a741a
3 changed files with 35 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import (
"path"
"path/filepath"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/fs"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/internal/op"
@ -54,7 +55,8 @@ func moveFiles(ctx context.Context, src, dst string, overwrite bool) (status int
//
// See section 9.8.5 for when various HTTP status codes apply.
func copyFiles(ctx context.Context, src, dst string, overwrite bool) (status int, err error) {
_, err = fs.Copy(ctx, src, dst)
dstDir := path.Dir(dst)
_, err = fs.Copy(context.WithValue(ctx, conf.NoTaskKey, struct{}{}), src, dstDir)
if err != nil {
return http.StatusInternalServerError, err
}