Fix #63.
This commit is contained in:
parent
8dceefd22c
commit
8215f02fec
2 changed files with 15 additions and 15 deletions
4
file.go
4
file.go
|
@ -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.
|
||||
|
|
|
@ -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}}
|
||||
|
|
Loading…
Reference in a new issue