Skip to content

Commit a0ec38e

Browse files
Merge pull request #452 from checkmarx-ltd/pr-CXFLW-1680-source-control-fix
Added version for scanWithSetting API
2 parents 278da87 + 205eb01 commit a0ec38e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/main/java/com/checkmarx/sdk/service/CxService.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,8 +1883,8 @@ public void uploadProjectSource(Integer projectId, File file) throws CheckmarxEx
18831883
public Integer uploadProjectSource(CxScanParams params,Integer projectId, File file,String comment) throws CheckmarxException {
18841884
HttpHeaders headers = authClient.createAuthHeaders();
18851885
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
1886-
18871886
LinkedMultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
1887+
headers.add("version", "1.2");
18881888
FileSystemResource value = new FileSystemResource(file);
18891889
map.add("projectId", projectId);
18901890
map.add("customFields", params.getCustomFields());
@@ -1896,9 +1896,7 @@ public Integer uploadProjectSource(CxScanParams params,Integer projectId, File f
18961896
map.add("presetId", getPresetId(params.getScanPreset()));
18971897
map.add("engineConfigurationId",getScanConfiguration(params.getScanConfiguration()));
18981898
map.add("zippedSource", value);
1899-
19001899
HttpEntity<LinkedMultiValueMap<String, Object>> requestEntity = new HttpEntity<>(map, headers);
1901-
19021900
try {
19031901
log.info("Updating Source details for project Id {}", projectId);
19041902
String response = restTemplate.exchange(cxProperties.getUrl().concat(PROJECT_SOURCE_FILE_WITH_SETTINGS), HttpMethod.POST, requestEntity, String.class).getBody();
@@ -2720,7 +2718,6 @@ private SASTScanReport prepareSources(CxScanParams params, Integer projectId, St
27202718
return new SASTScanReport(UNKNOWN_INT,true);
27212719
}else if(cxProperties.getEnabledZipScan() && !cxProperties.getOverrideProjectSetting()){
27222720
String clonedRepoPath = cxRepoFileHelper.prepareRepoFile(params);
2723-
uploadProjectSource(params,projectId, new File(clonedRepoPath),comment);
27242721
params.setFilePath(clonedRepoPath);
27252722
return new SASTScanReport(uploadProjectSource(params,projectId, new File(clonedRepoPath),comment),false);
27262723
}

0 commit comments

Comments
 (0)