Skip to content

Commit 8407f3a

Browse files
committed
Fix developer beta error introduced by previous commit
1 parent d0c72a3 commit 8407f3a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.BufferedReader;
2626
import java.io.IOException;
2727
import java.io.InputStreamReader;
28+
import java.net.HttpURLConnection;
2829
import java.net.URI;
2930
import java.net.URL;
3031
import java.net.URLConnection;
@@ -173,11 +174,17 @@ private void ensureOpen() throws IOException {
173174
if (pos > 0)
174175
connection.addRequestProperty("Range", "bytes=" + pos + "-");
175176
ch = Channels.newChannel(connection.getInputStream());
177+
if (connection instanceof HttpURLConnection c && c.getResponseCode() != 200) {
178+
throw new IOException("HTTP Response was " + c.getResponseCode() + " " + Utils.defIfNull(c.getResponseMessage(), ""));
179+
}
176180
String resp = connection.getHeaderField("Content-Range");
177181
if (resp != null) {
178182
length = Long.parseLong(resp.split("/")[1]);
179183
} else {
180184
resp = connection.getHeaderField("Content-Length");
185+
if (resp == null) {
186+
throw new IOException("No Content-Range or Content-Length header");
187+
}
181188
length = Long.parseLong(resp);
182189
}
183190
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,13 @@ protected String call() throws TSSException {
108108
saveFor(iosVersion, args);
109109
} catch (TSSException e) {
110110
if (manualVersion == null && manualIpswURL == null) {
111-
if (e.getMessage().contains("not being signed")) {
111+
var msg = e.getMessage();
112+
if (msg.contains("not being signed")) {
112113
System.err.println("Warning: ignoring unsigned version; API is likely out of date");
113114
continue; // ignore not being signed (API might not be updated)
114115
}
115-
if (e.getMessage().contains("Failed to load manifest") && includeBetas
116+
if ((msg.contains("Failed to load manifest") || msg.contains("Unable to extract BuildManifest"))
117+
&& includeBetas
116118
&& containsIgnoreCase(iosVersion.versionString(), "beta")
117119
&& iosVersion.ipswURL().contains("developer.apple")) {
118120
System.err.println("Warning: ignoring developer beta");

0 commit comments

Comments
 (0)