Skip to content

Instantly share code, notes, and snippets.

@Mistic92
Last active May 16, 2019 06:09
Show Gist options
  • Save Mistic92/32666a79e3f28e40b25f87234e228b00 to your computer and use it in GitHub Desktop.
Save Mistic92/32666a79e3f28e40b25f87234e228b00 to your computer and use it in GitHub Desktop.
Fix for Facebook avatar api bug for Glide using OkHttp
public class ApiNetworkInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
if (chain.request().url().host().equals("graph.facebook.com")) {
final Response response = chain.proceed(chain.request());
final int code = response.code();
if(code==200){
response.header("content-disposition","inline");
}
return response;
}
}
}
@tangxuelongcq
Copy link

how to use in my website ? i just want open this url as an image 'https://lookaside.facebook.com/platform/profilepic/?asid=110712723123784&height=50&width=50&ext=1524727705&hash=AeQz67iLhnaI36c6' in chrome, not download it.

@tareq3
Copy link

tareq3 commented Apr 29, 2018

@zhenguo
Copy link

zhenguo commented May 16, 2019

same here, I am getting this error from Android Studio Logcat:

2019-05-16 14:05:43.412 17616-17616/com.xx.xx W/Glide: Load failed for https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=2032166180243664&height=200&width=200&ext=1560578742&hash=AeQ9b1ak94nf6Vxn with size [100x100]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There was 1 cause:
java.net.UnknownHostException(Unable to resolve host "platform-lookaside.fbsbx.com": No address associated with hostname)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE
There was 1 cause:
java.net.UnknownHostException(Unable to resolve host "platform-lookaside.fbsbx.com": No address associated with hostname)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetch failed
There was 1 cause:
java.net.UnknownHostException(Unable to resolve host "platform-lookaside.fbsbx.com": No address associated with hostname)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class java.net.UnknownHostException: Unable to resolve host "platform-lookaside.fbsbx.com": No address associated with hostname

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment