chore: search by type with empty file name (#1228)

This commit is contained in:
WeidiDeng 2021-01-13 01:08:23 +08:00 committed by GitHub
parent c8257e848e
commit b6263eb607
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -75,7 +75,7 @@ func parseSearch(value string) *searchOptions {
value = typeRegexp.ReplaceAllString(value, "")
}
// If it's canse insensitive, put everything in lowercase.
// If it's case insensitive, put everything in lowercase.
if !opts.CaseSensitive {
value = strings.ToLower(value)
}

View File

@ -65,6 +65,10 @@ func Search(fs afero.Fs, scope, query string, checker rules.Checker, found func(
return found(originalPath, f)
}
}
} else {
originalPath = strings.TrimPrefix(originalPath, scope)
originalPath = strings.TrimPrefix(originalPath, "/")
return found(originalPath, f)
}
return nil