From 252b613e053b7e36ef98cad14855dba1e1369eb7 Mon Sep 17 00:00:00 2001 From: konwa <95535345+konwa@users.noreply.github.com> Date: Tue, 29 Nov 2022 10:41:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B5=8C=E5=A5=97=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9=E4=B8=8A=E4=BC=A0=E8=B7=AF=E5=BE=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=20(#35)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: huaihuai --- internal/command_upload.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/command_upload.go b/internal/command_upload.go index d2a54f9..642c3a7 100644 --- a/internal/command_upload.go +++ b/internal/command_upload.go @@ -75,8 +75,8 @@ func (r *CommandUpload) upload(file string, driveID string, fileID string) error log.Fatal(err) } response, err := r.cli.ali.File.CreateFolder(context.Background(), &aliyundrive.CreateFolderReq{ - DriveID: r.cli.driveID, - ParentFileID: r.cli.currentFileID, + DriveID: driveID, + ParentFileID: fileID, Name: fileInfo.Name(), }) if err != nil { @@ -92,6 +92,9 @@ func (r *CommandUpload) upload(file string, driveID string, fileID string) error } fmt.Printf("%s 上传成功.\n", filepath.Join(file, subFile.Name())) } + if err := r.cli.checkoutToParentDir(); err != nil { + return err + } } return nil }