Skip to content

Commit d0c72a3

Browse files
committed
Fix BuildManifest download when direct download is not available
1 parent 9774153 commit d0c72a3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/airsquared/blobsaver/app/Network.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,12 @@ static void makeVoidRequest(String url) throws IOException, InterruptedException
9191
}
9292

9393
static HttpResponse<Path> downloadFile(String url, Path dir) throws IOException, InterruptedException {
94-
return httpClient.send(HttpRequest.newBuilder(URI.create(url)).build(),
94+
var response = httpClient.send(HttpRequest.newBuilder(URI.create(url)).build(),
9595
HttpResponse.BodyHandlers.ofFile(dir, WRITE, CREATE, TRUNCATE_EXISTING));
96+
if (response.statusCode() != 200) {
97+
throw new IOException("HTTP Response was " + response);
98+
}
99+
return response;
96100
}
97101

98102
/**

0 commit comments

Comments
 (0)