This commit is contained in:
Nuno Cruces 2023-06-07 14:22:07 +01:00
parent 8dceefd22c
commit 8215f02fec
2 changed files with 15 additions and 15 deletions

View file

@ -182,8 +182,8 @@ func (f FileFilters) types() []string {
if res == nil {
return nil
}
// Workaround for macOS bug: first type cannot be a four letter extension, so prepend empty string.
return append([]string{""}, res...)
// Workaround for macOS bug: first type cannot be a four letter extension, so prepend dot string.
return append([]string{"."}, res...)
}
// Unix patterns are case-sensitive. Fold them if requested.

View file

@ -91,21 +91,21 @@ func TestFileFilters_types(t *testing.T) {
want []string
}{
{[]string{``}, nil},
{[]string{`*.png`}, []string{"", "png"}},
{[]string{`*.png`}, []string{".", "png"}},
{[]string{`*.pn?`}, nil},
{[]string{`*.pn;`}, []string{"", "pn;"}},
{[]string{`*.pn\?`}, []string{"", "pn?"}},
{[]string{`*.pn;`}, []string{".", "pn;"}},
{[]string{`*.pn\?`}, []string{".", "pn?"}},
{[]string{`*.[PpNnGg]`}, nil},
{[]string{`*.[Pp][Nn][Gg]`}, []string{"", "PNG"}},
{[]string{`*.[Pp][\Nn][G\g]`}, []string{"", "PNG"}},
{[]string{`*.[PNG`}, []string{"", "[PNG"}},
{[]string{`*.]PNG`}, []string{"", "]PNG"}},
{[]string{`*.[[]PNG`}, []string{"", "[PNG"}},
{[]string{`*.[]]PNG`}, []string{"", "]PNG"}},
{[]string{`*.[\[]PNG`}, []string{"", "[PNG"}},
{[]string{`*.[\]]PNG`}, []string{"", "]PNG"}},
{[]string{`public.png`}, []string{"", "public.png"}},
{[]string{`-public-.png`}, []string{"", "png"}},
{[]string{`*.[Pp][Nn][Gg]`}, []string{".", "PNG"}},
{[]string{`*.[Pp][\Nn][G\g]`}, []string{".", "PNG"}},
{[]string{`*.[PNG`}, []string{".", "[PNG"}},
{[]string{`*.]PNG`}, []string{".", "]PNG"}},
{[]string{`*.[[]PNG`}, []string{".", "[PNG"}},
{[]string{`*.[]]PNG`}, []string{".", "]PNG"}},
{[]string{`*.[\[]PNG`}, []string{".", "[PNG"}},
{[]string{`*.[\]]PNG`}, []string{".", "]PNG"}},
{[]string{`public.png`}, []string{".", "public.png"}},
{[]string{`-public-.png`}, []string{".", "png"}},
}
for i, tt := range tests {
filters := FileFilters{FileFilter{Patterns: tt.data}}