mirror of https://github.com/M66B/FairEmail.git
Refactoring
This commit is contained in:
parent
c6ed95f9cb
commit
bd4869e86b
|
@ -449,11 +449,8 @@ public class ContactInfo {
|
|||
favicon = (meta == null ? null : meta.attr("content"));
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(favicon)) {
|
||||
URL url = new URL(base, favicon);
|
||||
if ("https".equals(url.getProtocol()))
|
||||
return getFavicon(url);
|
||||
}
|
||||
if (!TextUtils.isEmpty(favicon))
|
||||
return getFavicon(new URL(base, favicon));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -462,7 +459,10 @@ public class ContactInfo {
|
|||
private static Bitmap getFavicon(URL url) throws IOException {
|
||||
Log.i("GET favicon " + url);
|
||||
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
if (!"https".equals(url.getProtocol()))
|
||||
throw new FileNotFoundException("http");
|
||||
|
||||
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setReadTimeout(FAVICON_READ_TIMEOUT);
|
||||
connection.setConnectTimeout(FAVICON_CONNECT_TIMEOUT);
|
||||
|
|
Loading…
Reference in New Issue