From 2898037ec5e4f3a559c461853aef9a9e1815809b Mon Sep 17 00:00:00 2001 From: sikai Date: Sun, 9 Nov 2025 10:26:19 +0800 Subject: [PATCH] fix uploadEntity.PartInfoList len 0 error --- internal/functions/panupload/upload.go | 4 ++++ internal/syncdrive/file_action_task.go | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/internal/functions/panupload/upload.go b/internal/functions/panupload/upload.go index 45cf51d..2e0964f 100644 --- a/internal/functions/panupload/upload.go +++ b/internal/functions/panupload/upload.go @@ -72,6 +72,10 @@ func (pu *PanUpload) Precreate() (err error) { } func (pu *PanUpload) UploadFile(ctx context.Context, partseq int, partOffset int64, partEnd int64, r rio.ReaderLen64, uploadClient *requester.HTTPClient) (uploadDone bool, uperr error) { + if len(pu.uploadOpEntity.PartInfoList) == 0 { + return true, nil + } + pu.lazyInit() // check url expired or not diff --git a/internal/syncdrive/file_action_task.go b/internal/syncdrive/file_action_task.go index b0937ba..745337d 100644 --- a/internal/syncdrive/file_action_task.go +++ b/internal/syncdrive/file_action_task.go @@ -528,6 +528,15 @@ func (f *FileActionTask) uploadFile(ctx context.Context) error { return nil } } else { + if len(f.syncItem.UploadEntity.PartInfoList) == 0 { + // finished + f.syncItem.Status = SyncFileStatusSuccess + f.syncItem.StatusUpdateTime = utils.NowTimeStr() + f.syncFileDb.Update(f.syncItem) + + PromptPrintln("上传完毕:" + f.syncItem.getPanFileFullPath()) + return nil + } // 检测链接是否过期 // check url expired or not uploadUrl := f.syncItem.UploadEntity.PartInfoList[f.syncItem.UploadPartSeq].UploadURL