mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-15 15:53:26 +00:00
Fixed a bug where filenames starting with i or e are mistakenly interpreted as regex
This commit is contained in:
@@ -55,7 +55,7 @@ func IsEmptyFilter(pattern string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func IsUnspecifiedFilter(pattern string) bool {
|
func IsUnspecifiedFilter(pattern string) bool {
|
||||||
if pattern[0] != '+' && pattern[0] != '-' && pattern[0] != 'i' && pattern[0] != 'e' {
|
if pattern[0] != '+' && pattern[0] != '-' && !strings.HasPrefix(pattern, "i:") && !strings.HasPrefix(pattern, "e:") {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -92,6 +92,17 @@ func TestMatchPattern(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, pattern := range []string{ "+", "-", "i:", "e:", "+a", "-a", "i:a", "e:a"} {
|
||||||
|
if IsUnspecifiedFilter(pattern) {
|
||||||
|
t.Errorf("pattern %s has a specified filter", pattern)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, pattern := range []string{ "i", "e", "ia", "ib", "a", "b"} {
|
||||||
|
if !IsUnspecifiedFilter(pattern) {
|
||||||
|
t.Errorf("pattern %s does not have a specified filter", pattern)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRateLimit(t *testing.T) {
|
func TestRateLimit(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user