diff --git a/drivers/123/driver.go b/drivers/123/driver.go index 32c053e2..4f2f15f6 100644 --- a/drivers/123/driver.go +++ b/drivers/123/driver.go @@ -13,7 +13,6 @@ import ( "github.com/alist-org/alist/v3/drivers/base" "github.com/alist-org/alist/v3/internal/driver" - "github.com/alist-org/alist/v3/internal/errs" "github.com/alist-org/alist/v3/internal/model" "github.com/alist-org/alist/v3/internal/stream" "github.com/alist-org/alist/v3/pkg/utils" @@ -164,7 +163,27 @@ func (d *Pan123) Rename(ctx context.Context, srcObj model.Obj, newName string) e } func (d *Pan123) Copy(ctx context.Context, srcObj, dstDir model.Obj) error { - return errs.NotSupport + if f, ok := srcObj.(File); ok { + data := base.Json{ + "fileList": []map[string]interface{}{ + { + "driveId": 0, + "etag": f.Etag, + "fileId": f.FileId, + "fileName": f.FileName, + "size": f.Size, + "type": f.Type, + }, + }, + "targetFileId": dstDir.GetID(), + } + _, err := d.Request(Copy, http.MethodPost, func(req *resty.Request) { + req.SetBody(data) + }, nil) + return err + } else { + return fmt.Errorf("can't convert srcObj to File") + } } func (d *Pan123) Remove(ctx context.Context, obj model.Obj) error { diff --git a/drivers/123/util.go b/drivers/123/util.go index 7e5a2397..f0bf8259 100644 --- a/drivers/123/util.go +++ b/drivers/123/util.go @@ -36,6 +36,7 @@ const ( Mkdir = MainApi + "/file/upload_request" Move = MainApi + "/file/mod_pid" Rename = MainApi + "/file/rename" + Copy = MainApi + "/restful/goapi/v1/file/copy/async" Trash = MainApi + "/file/trash" UploadRequest = MainApi + "/file/upload_request" UploadComplete = MainApi + "/file/upload_complete"