fix illegal download file issue #183

This commit is contained in:
tickstep 2022-11-02 21:52:11 +08:00
parent 2e4a6d94df
commit 00e1c3e3d4
2 changed files with 3 additions and 2 deletions

View File

@ -28,6 +28,7 @@ import (
"github.com/tickstep/library-go/requester/rio/speeds"
"io"
"net/http"
"strings"
"sync"
"time"
)
@ -388,7 +389,7 @@ func (der *Downloader) Execute() error {
cmdutil.Trigger(der.onCancelEvent)
return apierr
}
if durl == nil || durl.Url == "" || durl.Url == aliyunpan.IllegalDownloadUrl {
if durl == nil || durl.Url == "" || strings.HasPrefix(durl.Url, aliyunpan.IllegalDownloadUrlPrefix) {
logger.Verbosef("无法获取有效的下载链接: %+v\n", durl)
cmdutil.Trigger(der.onCancelEvent)
der.removeInstanceState() // 移除断点续传文件

View File

@ -227,7 +227,7 @@ func (f *FileActionTask) downloadFile(ctx context.Context) error {
f.syncFileDb.Update(f.syncItem)
return fmt.Errorf("无法获取有效的下载链接")
}
if durl.Url == aliyunpan.IllegalDownloadUrl {
if strings.HasPrefix(durl.Url, aliyunpan.IllegalDownloadUrlPrefix) {
logger.Verbosef("无法获取有效的下载链接: %+v\n", durl)
f.syncItem.Status = SyncFileStatusIllegal
f.syncItem.StatusUpdateTime = utils.NowTimeStr()