feat: case insensitive search by default
@@ -147,7 +147,7 @@ var (
type condition func(path string) bool
type searchOptions struct {
- CaseInsensitive bool
+ CaseSensitive bool
Conditions []condition
Terms []string
}
@@ -181,7 +181,7 @@ func videoCondition(path string) bool {
func parseSearch(value string) *searchOptions {
opts := &searchOptions{
- CaseInsensitive: strings.Contains(value, "case:insensitive"),
+ CaseSensitive: strings.Contains(value, "case:sensitive"),
Conditions: []condition{},
Terms: []string{},
}
@@ -215,7 +215,7 @@ func parseSearch(value string) *searchOptions {
}
// If it's canse insensitive, put everything in lowercase.
- if opts.CaseInsensitive {
+ if !opts.CaseSensitive {
value = strings.ToLower(value)
}
@@ -276,7 +276,7 @@ func search(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error)
scope = filepath.Clean(scope)
err = filepath.Walk(scope, func(path string, f os.FileInfo, err error) error {
- if search.CaseInsensitive {
+ if !search.CaseSensitive {
path = strings.ToLower(path)
}
