Skip to content

Commit

Permalink
Merge pull request #85 from snyk/fix/sarif-format-file-trimming
Browse files Browse the repository at this point in the history
fix: fixed sarif converter filepath trimming
  • Loading branch information
Arvi3d authored May 26, 2021
2 parents eaa109b + 0170b61 commit eb157b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sarif_converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function getSuggestions(analysisResults: IAnalysisResult): ISarifSuggestions {
suggestions[issueId] = [];
}
issues.forEach(issue => {
suggestions[issueId].push({ ...issue, file: file.substring(1) });
suggestions[issueId].push({ ...issue, file: file.charAt(0) === '/' ? file.substring(1) : file });
});
}
}
Expand Down Expand Up @@ -172,7 +172,7 @@ function getResults(allIssues: ISarifSuggestion[]): Result[] {
id: i,
physicalLocation: {
artifactLocation: {
uri: position.file.substring(1),
uri: position.file.charAt(0) === '/' ? position.file.substring(1) : position.file,
uriBaseId: '%SRCROOT%',
},
region: {
Expand Down

0 comments on commit eb157b6

Please sign in to comment.