Skip to content

Commit

Permalink
fix find by name
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <[email protected]>
  • Loading branch information
imilchev committed Dec 12, 2024
1 parent 0aed479 commit d6d54a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion providers/os/connection/tar/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func (fs *FS) Find(from string, r *regexp.Regexp, typ string, perm *uint32, dept
log.Trace().Str("path", k).Str("from", from).Str("prefix", from).Bool("prefix", p).Bool("m", m).Msg("check if matches")
if p && m {
entry := fs.FileMap[k]
if (typ == "directory" && entry.Typeflag == tar.TypeDir) || (typ == "file" && entry.Typeflag == tar.TypeReg) {
if (typ == "directory" && entry.Typeflag == tar.TypeDir) || (typ == "file" && entry.Typeflag == tar.TypeReg) || typ == "" {
list = append(list, k)
log.Debug().Msg("matches")
continue
Expand Down
5 changes: 5 additions & 0 deletions providers/os/resources/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ func (l *mqlFilesFind) list() ([]interface{}, error) {
if err != nil {
return nil, err
}
} else if len(l.Name.Data) > 0 {
compiledRegexp, err = regexp.Compile(l.Name.Data)
if err != nil {
return nil, err
}
}

var foundFiles []string
Expand Down

1 comment on commit d6d54a4

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: d6d54a4 Previous: ac14153 Ratio
BenchmarkScan_SingleAsset 14337252971 ns/op 239585696 B/op 5330352 allocs/op 2080853322 ns/op 239715552 B/op 5334676 allocs/op 6.89
BenchmarkScan_SingleAsset - ns/op 14337252971 ns/op 2080853322 ns/op 6.89

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.