Skip to content

Commit

Permalink
Merge pull request #194 from udda1996/improve-pull
Browse files Browse the repository at this point in the history
Update pull command text
  • Loading branch information
hevayo authored Jan 19, 2022
2 parents 9ccf823 + 1aa8da9 commit 7f3f8ba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/org/ballerinalang/command/util/ToolUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ public static boolean downloadDistribution(PrintStream printStream, String distr
HttpURLConnection conn = null;
try {
if (!ToolUtil.checkDistributionAvailable(distribution)) {
printStream.println("Fetching the '" + distribution + "' distribution from the remote server...");
URL url = new URL(ToolUtil.getServerURL() + "/distributions/" + distributionVersion);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
Expand All @@ -444,13 +443,15 @@ public static boolean downloadDistribution(PrintStream printStream, String distr
conn.setRequestProperty("testMode", "true");
}
if (conn.getResponseCode() == 302) {
printStream.println("Fetching the '" + distribution + "' distribution from the remote server...");
String newUrl = conn.getHeaderField("Location");
conn = (HttpURLConnection) new URL(newUrl).openConnection();
conn.setRequestProperty("content-type", "binary/data");
ToolUtil.downloadAndSetupDist(printStream, conn, distribution);
ToolUtil.getDependency(printStream, distribution, distributionType, distributionVersion);
return false;
} else if (conn.getResponseCode() == 200) {
printStream.println("Fetching the '" + distribution + "' distribution from the remote server...");
ToolUtil.downloadAndSetupDist(printStream, conn, distribution);
ToolUtil.getDependency(printStream, distribution, distributionType, distributionVersion);
return false;
Expand Down

0 comments on commit 7f3f8ba

Please sign in to comment.