mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(filters): sanitize description (#1781)
feat(filters): sanitize description
This commit is contained in:
parent
8cd7d67cee
commit
f89ea9e2ff
2 changed files with 17 additions and 0 deletions
|
@ -332,6 +332,11 @@ func (f *Filter) Sanitize() error {
|
||||||
f.ExceptReleases = sanitize.FilterString(f.ExceptReleases)
|
f.ExceptReleases = sanitize.FilterString(f.ExceptReleases)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !f.UseRegexDescription {
|
||||||
|
f.MatchDescription = sanitize.FilterString(f.MatchDescription)
|
||||||
|
f.ExceptDescription = sanitize.FilterString(f.ExceptDescription)
|
||||||
|
}
|
||||||
|
|
||||||
f.MatchReleaseGroups = sanitize.FilterString(f.MatchReleaseGroups)
|
f.MatchReleaseGroups = sanitize.FilterString(f.MatchReleaseGroups)
|
||||||
f.ExceptReleaseGroups = sanitize.FilterString(f.ExceptReleaseGroups)
|
f.ExceptReleaseGroups = sanitize.FilterString(f.ExceptReleaseGroups)
|
||||||
|
|
||||||
|
|
|
@ -1966,6 +1966,15 @@ func TestFilter_CheckFilter1(t *testing.T) {
|
||||||
rejectionReasons: &RejectionReasons{data: []Rejection{}},
|
rejectionReasons: &RejectionReasons{data: []Rejection{}},
|
||||||
wantMatch: true,
|
wantMatch: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "test_44",
|
||||||
|
fields: fields{
|
||||||
|
MatchDescription: "*black?metal*",
|
||||||
|
},
|
||||||
|
args: args{&Release{Description: "dog\ncat\r\nblack metalo\negg"}},
|
||||||
|
rejectionReasons: &RejectionReasons{data: []Rejection{}},
|
||||||
|
wantMatch: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
@ -1989,6 +1998,9 @@ func TestFilter_CheckFilter1(t *testing.T) {
|
||||||
MatchReleaseTags: tt.fields.MatchReleaseTags,
|
MatchReleaseTags: tt.fields.MatchReleaseTags,
|
||||||
ExceptReleaseTags: tt.fields.ExceptReleaseTags,
|
ExceptReleaseTags: tt.fields.ExceptReleaseTags,
|
||||||
UseRegexReleaseTags: tt.fields.UseRegexReleaseTags,
|
UseRegexReleaseTags: tt.fields.UseRegexReleaseTags,
|
||||||
|
MatchDescription: tt.fields.MatchDescription,
|
||||||
|
ExceptDescription: tt.fields.ExceptDescription,
|
||||||
|
UseRegexDescription: tt.fields.UseRegexDescription,
|
||||||
Scene: tt.fields.Scene,
|
Scene: tt.fields.Scene,
|
||||||
Origins: tt.fields.Origins,
|
Origins: tt.fields.Origins,
|
||||||
ExceptOrigins: tt.fields.ExceptOrigins,
|
ExceptOrigins: tt.fields.ExceptOrigins,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue