Skip to content

Commit d17e505

Browse files
committed
One more scenario & cleanup
1 parent 9539bb9 commit d17e505

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

components/ee/agent-smith/pkg/detector/filesystem.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,6 @@ func (det *fileDetector) scanWorkspaceDirectory(wsDir WorkspaceDirectory, signat
292292

293293
// findMatchingFiles finds files matching a pattern (supports wildcards and relative paths)
294294
func (det *fileDetector) findMatchingFiles(workspaceRoot, relativeFilePath string) []string {
295-
// If relativeFilePath has no wildcards, treat as direct relative path
296-
// if !strings.Contains(relativeFilePath, "*") && !strings.Contains(relativeFilePath, "?") {
297-
// filePath := filepath.Join(workspaceRoot, relativeFilePath)
298-
// if _, err := os.Stat(filePath); err == nil {
299-
// return []string{filePath}
300-
// }
301-
// return nil
302-
// }
303-
304295
// For wildcard relativeFilePaths, we need to search within the workspace
305296
// For simplicity, only search in the root directory for now
306297
// TODO: Could be extended to search subdirectories up to WorkspaceDepth

components/ee/agent-smith/pkg/detector/filesystem_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,15 @@ func TestFindMatchingFiles(t *testing.T) {
276276
expected: []string{},
277277
},
278278
{
279-
name: "existing file in sub-folder",
279+
name: "wildcard to dip into a sub-folder",
280280
filename: "*/data.txt",
281281
expected: []string{filepath.Join(tempDir, "dotfiles/data.txt")},
282282
},
283+
{
284+
name: "exact match",
285+
filename: "dotfiles/data.txt",
286+
expected: []string{filepath.Join(tempDir, "dotfiles/data.txt")},
287+
},
283288
}
284289

285290
for _, tt := range tests {

0 commit comments

Comments
 (0)