Skip to content

Commit

Permalink
Fix gosec issues (#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
EyalDelarea authored Aug 20, 2023
1 parent a4bc0ec commit f64d0fc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions artifactory/services/gitlfsclean_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func TestExtractRepo(t *testing.T) {

func TestGetLfsFilesFromGit(t *testing.T) {
log.SetLogger(log.NewLogger(log.DEBUG, nil))
// #nosec G101
fileId := "4bf4c8c0fef3f5c8cf6f255d1c784377138588c0a9abe57e440bce3ccb350c2e"
gitPath := getCliDotGitPath(t)
refs := strings.Join([]string{"refs", "heads", "*"}, "/")
Expand Down
6 changes: 3 additions & 3 deletions artifactory/services/go/go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ func TestCreateUrlPath(t *testing.T) {
{"withoutBuildProperties", "go-repo/github.com/jfrog/test/@v/v1.1.1.zip", "", "http://test.url/api/go/", "http://test.url/api/go/go-repo/github.com/jfrog/test/@v/v1.1.1.zip"},
{"withoutBuildPropertiesModExtension", "go-repo/github.com/jfrog/test/@v/v1.1.1.mod", "", "http://test.url/api/go/", "http://test.url/api/go/go-repo/github.com/jfrog/test/@v/v1.1.1.mod"},
}
for _, test := range tests {
for i, test := range tests {
t.Run(test.name, func(t *testing.T) {
assert.NoError(t, CreateUrlPath(test.pathInArtifactory, test.props, &test.goApiUrl))
assert.NoError(t, CreateUrlPath(tests[i].pathInArtifactory, tests[i].props, &tests[i].goApiUrl))
// The props might have a different order each time, so we split the URLs and check if the lists are equal (ignoring the order)
assert.ElementsMatch(t, strings.Split(test.goApiUrl, ";"), strings.Split(test.expectedUrl, ";"))
assert.ElementsMatch(t, strings.Split(tests[i].goApiUrl, ";"), strings.Split(tests[i].expectedUrl, ";"))
})
}
}
2 changes: 1 addition & 1 deletion pipelines/services/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (rs *RunService) GetRunStatus(branch, pipeName string, isMultiBranch bool)
httpDetails := rs.getHttpDetails()

// Query params
queryParams := make(map[string]string, 0)
queryParams := make(map[string]string)
if isMultiBranch {
// Add this query param only when pipeline source is multi-branch
queryParams["pipelineSourceBranch"] = branch
Expand Down
2 changes: 1 addition & 1 deletion pipelines/services/syncstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (ss *SyncStatusService) GetSyncPipelineResourceStatus(repoName, branch stri
if resourceErr != nil {
return []PipelineSyncStatus{}, fmt.Errorf("unable to fetch resourceID for '%s'. Second error: %s", repoName, resourceErr.Error())
}
queryParams := make(map[string]string, 0)
queryParams := make(map[string]string)
if *res.IsMultiBranch {
queryParams["pipelineSourceBranches"] = branch
}
Expand Down

0 comments on commit f64d0fc

Please sign in to comment.