diff --git a/lib/ignore/ignore_test.go b/lib/ignore/ignore_test.go index 63d0bb5a..18ff24e9 100644 --- a/lib/ignore/ignore_test.go +++ b/lib/ignore/ignore_test.go @@ -1054,3 +1054,28 @@ func TestIssue5009(t *testing.T) { t.Error("skipIgnoredDirs should not be true with includes") } } + +func TestSpecialChars(t *testing.T) { + pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true)) + + stignore := `(?i)/#recycle +(?i)/#nosync +(?i)/$Recycle.bin +(?i)/$RECYCLE.BIN +(?i)/System Volume Information` + if err := pats.Parse(bytes.NewBufferString(stignore), ".stignore"); err != nil { + t.Fatal(err) + } + + cases := []string{ + "#nosync", + "$RECYCLE.BIN", + filepath.FromSlash("$RECYCLE.BIN/S-1-5-18/desktop.ini"), + } + + for _, c := range cases { + if !pats.Match(c).IsIgnored() { + t.Errorf("%q should be ignored", c) + } + } +}