Fixed file protocol bugs

dev
Ice3man543 2021-03-08 19:20:40 +05:30
parent 1cfc5ce6ef
commit 2717a8b647
4 changed files with 6 additions and 6 deletions

View File

@ -66,20 +66,20 @@ func (r *Request) Compile(options *protocols.ExecuterOptions) error {
if extension == "all" {
r.allExtensions = true
} else {
if strings.HasPrefix(extension, ".") {
if !strings.HasPrefix(extension, ".") {
extension = "." + extension
}
r.extensions[extension] = struct{}{}
}
}
for _, extension := range defaultDenylist {
if strings.HasPrefix(extension, ".") {
if !strings.HasPrefix(extension, ".") {
extension = "." + extension
}
r.extensionDenylist[extension] = struct{}{}
}
for _, extension := range r.ExtensionDenylist {
if strings.HasPrefix(extension, ".") {
if !strings.HasPrefix(extension, ".") {
extension = "." + extension
}
r.extensionDenylist[extension] = struct{}{}

View File

@ -16,7 +16,7 @@ func TestFileCompile(t *testing.T) {
ID: templateID,
MaxSize: 1024,
NoRecursive: false,
Extensions: []string{"*", ".lock"},
Extensions: []string{"all", ".lock"},
ExtensionDenylist: []string{".go"},
}
executerOpts := testutils.NewMockExecuterOptions(options, &testutils.TemplateInfo{

View File

@ -19,7 +19,7 @@ func TestFindInputPaths(t *testing.T) {
ID: templateID,
MaxSize: 1024,
NoRecursive: false,
Extensions: []string{"*", ".lock"},
Extensions: []string{"all", ".lock"},
ExtensionDenylist: []string{".go"},
}
executerOpts := testutils.NewMockExecuterOptions(options, &testutils.TemplateInfo{

View File

@ -23,7 +23,7 @@ func TestFileExecuteWithResults(t *testing.T) {
ID: templateID,
MaxSize: 1024,
NoRecursive: false,
Extensions: []string{"*"},
Extensions: []string{"all"},
ExtensionDenylist: []string{".go"},
Operators: operators.Operators{
Matchers: []*matchers.Matcher{{