Skip to content

Commit 2e9fd51

Browse files
authored
Merge pull request #51 from sacha-c/scan-directory-with-slug
fix: scan directory should use slug
2 parents a9d451a + 585131c commit 2e9fd51

File tree

4 files changed

+4
-1
lines changed

4 files changed

+4
-1
lines changed

internal/patrol/patrol.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func (s *sheriffService) getProjectList(locs []config.ProjectLocation) (projects
179179

180180
// scanProject scans a project for vulnerabilities using the osv scanner.
181181
func (s *sheriffService) scanProject(project repository.Project) (report *scanner.Report, err error) {
182-
dir, err := os.MkdirTemp(tempScanDir, fmt.Sprintf("%v-", project.Name))
182+
dir, err := os.MkdirTemp(tempScanDir, fmt.Sprintf("%v-", project.Slug))
183183
if err != nil {
184184
return nil, errors.Join(errors.New("failed to create project temporary directory"), err)
185185
}

internal/repository/github/github.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ func mapGithubProject(r github.Repository) repository.Project {
191191
ID: int(valueOrEmpty(r.ID)),
192192
Name: valueOrEmpty(r.Name),
193193
Path: valueOrEmpty(r.FullName),
194+
Slug: valueOrEmpty(r.Name),
194195
WebURL: valueOrEmpty(r.HTMLURL),
195196
RepoUrl: valueOrEmpty(r.HTMLURL),
196197
Repository: repository.Github,

internal/repository/gitlab/gitlab.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ func mapProject(p gitlab.Project) repository.Project {
320320
return repository.Project{
321321
ID: p.ID,
322322
Name: p.Name,
323+
Slug: p.Path,
323324
Path: p.PathWithNamespace,
324325
WebURL: p.WebURL,
325326
RepoUrl: p.HTTPURLToRepo,

internal/repository/repository.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const (
1212
type Project struct {
1313
ID int
1414
Name string
15+
Slug string
1516
Path string
1617
WebURL string
1718
RepoUrl string

0 commit comments

Comments
 (0)