Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions drivers/123/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions drivers/123/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down