Skip to content

Commit

Permalink
Bugfix - Add missing sha2 to upload files (#605)
Browse files Browse the repository at this point in the history
  • Loading branch information
Or-Geva authored Jan 20, 2022
1 parent f061c81 commit 6d67573
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ private List<Artifact> convertDeployDetailsToArtifacts(Set<DeployDetails> detail
artifactBuilder
.md5(detail.getMd5())
.sha1(detail.getSha1())
.sha256(detail.getSha256())
.type(ext)
.localPath(detail.getFile().getAbsolutePath())
.remotePath(detail.getArtifactPath())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import static org.jfrog.build.api.util.FileChecksumCalculator.MD5_ALGORITHM;
import static org.jfrog.build.api.util.FileChecksumCalculator.SHA1_ALGORITHM;
import static org.jfrog.build.api.util.FileChecksumCalculator.SHA256_ALGORITHM;
import static org.jfrog.build.extractor.clientConfiguration.util.PathsUtils.removeUnescapedChar;

/**
Expand Down Expand Up @@ -47,16 +48,16 @@ public static DeployDetails buildDeployDetails(String targetPath, File artifactF
// calculate the sha1 checksum and add it to the deploy artifactsToDeploy
Map<String, String> checksums;
try {
checksums = FileChecksumCalculator.calculateChecksums(artifactFile, MD5_ALGORITHM, SHA1_ALGORITHM);
checksums = FileChecksumCalculator.calculateChecksums(artifactFile, MD5_ALGORITHM, SHA1_ALGORITHM, SHA256_ALGORITHM);
} catch (NoSuchAlgorithmException e) {
throw new NoSuchAlgorithmException(
String.format("Could not find checksum algorithm for %s or %s.", MD5_ALGORITHM, SHA1_ALGORITHM), e);
String.format("Could not find checksum algorithm for %s or %s or %s.", MD5_ALGORITHM, SHA1_ALGORITHM, SHA256_ALGORITHM), e);
}
DeployDetails.Builder builder = new DeployDetails.Builder()
.file(artifactFile)
.artifactPath(path)
.targetRepository(getRepositoryKey(uploadTarget))
.md5(checksums.get(MD5_ALGORITHM)).sha1(checksums.get(SHA1_ALGORITHM))
.md5(checksums.get(MD5_ALGORITHM)).sha1(checksums.get(SHA1_ALGORITHM)).sha256(checksums.get(SHA256_ALGORITHM))
.explode(BooleanUtils.toBoolean(explode))
.addProperties(SpecsHelper.getPropertiesMap(props))
.packageType(DeployDetails.PackageType.GENERIC);
Expand Down

0 comments on commit 6d67573

Please sign in to comment.