mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
fix(actions): trim tags categories and save path for qbittorrent (#916)
trim tags, categories and save path for qbit
This commit is contained in:
parent
1abc260047
commit
cf61bcf672
1 changed files with 17 additions and 3 deletions
|
@ -6,6 +6,7 @@ package action
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/autobrr/autobrr/internal/domain"
|
"github.com/autobrr/autobrr/internal/domain"
|
||||||
"github.com/autobrr/autobrr/pkg/errors"
|
"github.com/autobrr/autobrr/pkg/errors"
|
||||||
|
@ -96,14 +97,27 @@ func (s *service) prepareQbitOptions(action *domain.Action) (map[string]string,
|
||||||
// if ORIGINAL then leave empty
|
// if ORIGINAL then leave empty
|
||||||
}
|
}
|
||||||
if action.SavePath != "" {
|
if action.SavePath != "" {
|
||||||
opts.SavePath = action.SavePath
|
opts.SavePath = strings.TrimSpace(action.SavePath)
|
||||||
opts.AutoTMM = false
|
opts.AutoTMM = false
|
||||||
}
|
}
|
||||||
if action.Category != "" {
|
if action.Category != "" {
|
||||||
opts.Category = action.Category
|
opts.Category = strings.TrimSpace(action.Category)
|
||||||
}
|
}
|
||||||
if action.Tags != "" {
|
if action.Tags != "" {
|
||||||
opts.Tags = action.Tags
|
// Split the action.Tags string by comma
|
||||||
|
tags := strings.Split(action.Tags, ",")
|
||||||
|
|
||||||
|
// Create a new slice to store the trimmed tags
|
||||||
|
trimmedTags := make([]string, 0, len(tags))
|
||||||
|
|
||||||
|
// Iterate over the tags and trim each one
|
||||||
|
for _, tag := range tags {
|
||||||
|
trimmedTag := strings.TrimSpace(tag)
|
||||||
|
trimmedTags = append(trimmedTags, trimmedTag)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Join the trimmed tags back together with commas
|
||||||
|
opts.Tags = strings.Join(trimmedTags, ",")
|
||||||
}
|
}
|
||||||
if action.LimitUploadSpeed > 0 {
|
if action.LimitUploadSpeed > 0 {
|
||||||
opts.LimitUploadSpeed = action.LimitUploadSpeed
|
opts.LimitUploadSpeed = action.LimitUploadSpeed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue