fix(qbittorrent): download task option not working (#2666)

pull/2723/head
Aaron Liu 2025-07-25 10:15:55 +08:00
parent 488f32512d
commit 60bf0e02b3
1 changed files with 16 additions and 16 deletions

View File

@ -32,18 +32,18 @@ const (
) )
var ( var (
supportDownloadOptions = map[string]bool{ downloadOptionFormatTypes = map[string]string{
"cookie": true, "cookie": "%s",
"skip_checking": true, "skip_checking": "%s",
"root_folder": true, "root_folder": "%s",
"rename": true, "rename": "%s",
"upLimit": true, "upLimit": "%.0f",
"dlLimit": true, "dlLimit": "%.0f",
"ratioLimit": true, "ratioLimit": "%f",
"seedingTimeLimit": true, "seedingTimeLimit": "%.0f",
"autoTMM": true, "autoTMM": "%t",
"sequentialDownload": true, "sequentialDownload": "%s",
"firstLastPiecePrio": true, "firstLastPiecePrio": "%t",
} }
) )
@ -271,15 +271,15 @@ func (c *qbittorrentClient) CreateTask(ctx context.Context, url string, options
// Apply global options // Apply global options
for k, v := range c.options.Options { for k, v := range c.options.Options {
if _, ok := supportDownloadOptions[k]; ok { if _, ok := downloadOptionFormatTypes[k]; ok {
_ = formWriter.WriteField(k, fmt.Sprintf("%s", v)) _ = formWriter.WriteField(k, fmt.Sprintf(downloadOptionFormatTypes[k], v))
} }
} }
// Apply group options // Apply group options
for k, v := range options { for k, v := range options {
if _, ok := supportDownloadOptions[k]; ok { if _, ok := downloadOptionFormatTypes[k]; ok {
_ = formWriter.WriteField(k, fmt.Sprintf("%s", v)) _ = formWriter.WriteField(k, fmt.Sprintf(downloadOptionFormatTypes[k], v))
} }
} }