Skip to content

Commit

Permalink
Fix developer beta error introduced by previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
airsquared committed Jul 20, 2023
1 parent d0c72a3 commit 8407f3a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/main/java/airsquared/blobsaver/app/Network.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
Expand Down Expand Up @@ -173,11 +174,17 @@ private void ensureOpen() throws IOException {
if (pos > 0)
connection.addRequestProperty("Range", "bytes=" + pos + "-");
ch = Channels.newChannel(connection.getInputStream());
if (connection instanceof HttpURLConnection c && c.getResponseCode() != 200) {
throw new IOException("HTTP Response was " + c.getResponseCode() + " " + Utils.defIfNull(c.getResponseMessage(), ""));
}
String resp = connection.getHeaderField("Content-Range");
if (resp != null) {
length = Long.parseLong(resp.split("/")[1]);
} else {
resp = connection.getHeaderField("Content-Length");
if (resp == null) {
throw new IOException("No Content-Range or Content-Length header");
}
length = Long.parseLong(resp);
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/airsquared/blobsaver/app/TSS.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,13 @@ protected String call() throws TSSException {
saveFor(iosVersion, args);
} catch (TSSException e) {
if (manualVersion == null && manualIpswURL == null) {
if (e.getMessage().contains("not being signed")) {
var msg = e.getMessage();
if (msg.contains("not being signed")) {
System.err.println("Warning: ignoring unsigned version; API is likely out of date");
continue; // ignore not being signed (API might not be updated)
}
if (e.getMessage().contains("Failed to load manifest") && includeBetas
if ((msg.contains("Failed to load manifest") || msg.contains("Unable to extract BuildManifest"))
&& includeBetas
&& containsIgnoreCase(iosVersion.versionString(), "beta")
&& iosVersion.ipswURL().contains("developer.apple")) {
System.err.println("Warning: ignoring developer beta");
Expand Down

0 comments on commit 8407f3a

Please sign in to comment.