You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the http response is not successful (http code not beetween 200 and 300), there's no need to process it further.
Currently, all http responses with an unsuccessful response code and a body are processed, which is unecessary. Some http servers return some descriptive error text in the response body and Glide attempt to decode it as bitmap, which of course will fail (skia error in the logcat).
I suggest making this modification:
@Override
public InputStream loadData(Priority priority) throws Exception {
Request.Builder builder = new Request.Builder().url(url.toString());
if(userAgent != null) {
builder.header("User-Agent", userAgent);
}
request = builder.build();
Response response = client.newCall(request).execute();
if(!response.isSuccessful()) throw new IOException("request failed with code: " + response.code());
return response.body().byteStream();
}
This URL can be used for testing (always returns a 503 with an html error body):
Additionally, loadData() could abort processing if there's a Content-Type header in the response whose value is not one of the supported image type by Glide.
If the http response is not successful (http code not beetween 200 and 300), there's no need to process it further.
Currently, all http responses with an unsuccessful response code and a body are processed, which is unecessary. Some http servers return some descriptive error text in the response body and Glide attempt to decode it as bitmap, which of course will fail (skia error in the logcat).
I suggest making this modification:
This URL can be used for testing (always returns a 503 with an html error body):
http://images.tidalhifi.com/im/im?w=160&h=107&artistid=4920567
The text was updated successfully, but these errors were encountered: