fix: create task with default select files (#374)

This commit is contained in:
Levi authored and GitHub committed 2024-02-02 09:44:00 +08:00
1 parent d60d370463
commit a816b9ccc8
1 file changed
+3 -3
+3 -3
View File
@@ -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