Skip to content

Commit

Permalink
fix(manifest): Fix using base64 artifacts in manifest bakery
Browse files Browse the repository at this point in the history
  • Loading branch information
posox authored and lwander committed May 15, 2018
1 parent c4aad5b commit ae12d5d
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -12,12 +12,15 @@
import org.springframework.stereotype.Component;
import retrofit.client.Response;

import javax.xml.bind.DatatypeConverter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.UUID;

@Component
Expand All @@ -35,8 +38,12 @@ public BakeRecipe buildBakeRecipe(BakeManifestEnvironment env, BakeManifestReque
private RetrySupport retrySupport = new RetrySupport();

private String nameFromReference(String reference) {
return reference.replace("/", "_")
.replace(":", "_");
try {
MessageDigest md = MessageDigest.getInstance("MD5");
return DatatypeConverter.printHexBinary(md.digest(reference.getBytes()));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Failed to save bake manifest: " + e.getMessage(), e);
}
}

protected Path downloadArtifactToTmpFile(BakeManifestEnvironment env, Artifact artifact) throws IOException {
Expand Down

0 comments on commit ae12d5d

Please sign in to comment.