Skip to content

Commit

Permalink
add a fix for windows volumes
Browse files Browse the repository at this point in the history
Signed-off-by: Simar <[email protected]>
  • Loading branch information
simar7 committed Apr 6, 2023
1 parent c5869b5 commit cbc439e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/misconf/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,12 @@ func (s *Scanner) Scan(ctx context.Context, files []types.File) ([]types.Misconf
return nil, xerrors.Errorf("scanfs for %s scan from memoryfs failed: %w", t, err)
}
} else {
results, err = scanner.ScanFS(ctx, extrafs.OSDir(fmt.Sprintf("%c", os.PathSeparator)), rootDir)
// Support Windows paths
if volume := filepath.VolumeName(rootDir); volume != "" {
rootDir = strings.TrimPrefix(filepath.ToSlash(rootDir), volume+"/")
}

results, err = scanner.ScanFS(ctx, extrafs.OSDir("/"), rootDir)
if err != nil {
return nil, xerrors.Errorf("scanfs for %s scan failed: %w", t, err)
}
Expand Down

0 comments on commit cbc439e

Please sign in to comment.