fix(bt): honor selected files when creating resolved tasks (#1523)

This commit is contained in:
Levi authored and GitHub committed 2026-09-18 22:32:09 +08:00
1 parent 743f356567
commit 1ab452ced8
12 files changed
+573 -21

No files matched your search

+25 -12
View File
@@ -363,20 +363,9 @@ func (f *Fetcher) Resolve(req *base.Request, opts *base.Options) error {
f.meta.Opts = &base.Options{}
}
// Parse options
if err := base.ParseOptExtra[fhttp.OptsExtra](opts); err != nil {
if err := f.initOptions(); err != nil {
return err
}
if opts.Extra == nil {
opts.Extra = &fhttp.OptsExtra{}
}
extra := opts.Extra.(*fhttp.OptsExtra)
if extra.Connections <= 0 {
extra.Connections = f.config.Connections
if extra.Connections <= 0 {
extra.Connections = 1
}
}
f.setState(stateResolving)
@@ -648,7 +637,31 @@ func (f *Fetcher) cleanupPrefetchFile() {
f.resolveFallback.Store(false)
}
// Options may be replaced between Resolve and Start when creating a resolved task.
func (f *Fetcher) initOptions() error {
opts := f.meta.Opts
// Parse options
if err := base.ParseOptExtra[fhttp.OptsExtra](opts); err != nil {
return err
}
if opts.Extra == nil {
opts.Extra = &fhttp.OptsExtra{}
}
extra := opts.Extra.(*fhttp.OptsExtra)
if extra.Connections <= 0 {
extra.Connections = f.config.Connections
if extra.Connections <= 0 {
extra.Connections = 1
}
}
return nil
}
func (f *Fetcher) Start() error {
if err := f.initOptions(); err != nil {
return err
}
state := f.getState()
switch state {