From a816b9ccc812c1413ff02e9a1ba50711a1faca70 Mon Sep 17 00:00:00 2001 From: Levi Date: Fri, 2 Feb 2024 09:44:00 +0800 Subject: [PATCH] fix: create task with default select files (#374) --- pkg/download/downloader.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/download/downloader.go b/pkg/download/downloader.go index 7e466ced..adce3b01 100644 --- a/pkg/download/downloader.go +++ b/pkg/download/downloader.go @@ -302,9 +302,6 @@ func (d *Downloader) CreateDirect(req *base.Request, opts *base.Options) (taskId } func (d *Downloader) Create(rrId string, opts *base.Options) (taskId string, err error) { - if opts == nil { - opts = &base.Options{} - } d.fetcherMapLock.RLock() fetcher, ok := d.fetcherCache[rrId] d.fetcherMapLock.RUnlock() @@ -750,6 +747,9 @@ func (d *Downloader) doCreate(fetcher fetcher.Fetcher, opts *base.Options) (task if opts == nil { opts = &base.Options{} } + if opts.SelectFiles == nil { + opts.SelectFiles = make([]int, 0) + } meta := fetcher.Meta() meta.Opts = opts