follow 301 for authorization headers during download (#5612)

This commit is contained in:
Tony Tam 2022-01-04 07:11:24 -08:00 committed by GitHub
parent 92759d8d05
commit 814cd0f88d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -50,6 +50,10 @@ public class BasicAuthorizationInterceptor implements Interceptor {
}
Request.Builder newRequest = request.newBuilder();
if (!TextUtils.equals(response.request().url().toString(), request.url().toString())) {
newRequest.url(response.request().url());
}
Log.d(TAG, "Authorization failed, re-trying with ISO-8859-1 encoded credentials");
String credentials = HttpDownloader.encodeCredentials(parts[0], parts[1], "ISO-8859-1");
newRequest.header("Authorization", credentials);