From eca89c432ff1a56a611c48c3b0c103a69c9971cf Mon Sep 17 00:00:00 2001 From: Lars Wander Date: Wed, 9 May 2018 09:35:13 -0400 Subject: [PATCH] fix(artifacts/github): fix error with malformed ref (#2613) --- .../artifacts/github/GitHubArtifactCredentials.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clouddriver-artifacts/src/main/java/com/netflix/spinnaker/clouddriver/artifacts/github/GitHubArtifactCredentials.java b/clouddriver-artifacts/src/main/java/com/netflix/spinnaker/clouddriver/artifacts/github/GitHubArtifactCredentials.java index 9f15eebc6ed..9499204645c 100644 --- a/clouddriver-artifacts/src/main/java/com/netflix/spinnaker/clouddriver/artifacts/github/GitHubArtifactCredentials.java +++ b/clouddriver-artifacts/src/main/java/com/netflix/spinnaker/clouddriver/artifacts/github/GitHubArtifactCredentials.java @@ -91,7 +91,12 @@ private String credentialsFromFile(String filename) { } public InputStream download(Artifact artifact) throws IOException { - HttpUrl.Builder metadataUrlBuilder = HttpUrl.parse(artifact.getReference()).newBuilder(); + HttpUrl.Builder metadataUrlBuilder; + try { + metadataUrlBuilder = HttpUrl.parse(artifact.getReference()).newBuilder(); + } catch (Exception e) { + throw new IllegalArgumentException("Malformed github content URL in 'reference'. Read more here https://www.spinnaker.io/reference/artifacts/types/github-file/: " + e.getMessage(), e); + } String version = artifact.getVersion(); if (StringUtils.isEmpty(version)) { log.info("No version specified for artifact {}, using 'master'.", version);