Merge pull request #5280 from ByteHamster/fix-null-location
Fix crash when a server returns a null location
This commit is contained in:
commit
f4c92e88db
|
@ -77,6 +77,9 @@ public class AntennapodHttpClient {
|
||||||
if (response.code() == HttpURLConnection.HTTP_MOVED_PERM
|
if (response.code() == HttpURLConnection.HTTP_MOVED_PERM
|
||||||
|| response.code() == StatusLine.HTTP_PERM_REDIRECT) {
|
|| response.code() == StatusLine.HTTP_PERM_REDIRECT) {
|
||||||
String location = response.header("Location");
|
String location = response.header("Location");
|
||||||
|
if (location == null) {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
if (location.startsWith("/")) { // URL is not absolute, but relative
|
if (location.startsWith("/")) { // URL is not absolute, but relative
|
||||||
HttpUrl url = request.url();
|
HttpUrl url = request.url();
|
||||||
location = url.scheme() + "://" + url.host() + location;
|
location = url.scheme() + "://" + url.host() + location;
|
||||||
|
|
Loading…
Reference in New Issue