Merge pull request #5861 from ByteHamster/fix-sending-empty-credentials

Do not send null:null as credentials
This commit is contained in:
ByteHamster 2022-04-26 19:09:18 +02:00 committed by GitHub
commit ed5d9212ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -47,7 +47,9 @@ public class BasicAuthorizationInterceptor implements Interceptor {
if (request.tag() instanceof DownloadRequest) {
DownloadRequest downloadRequest = (DownloadRequest) request.tag();
userInfo = URIUtil.getURIFromRequestUrl(downloadRequest.getSource()).getUserInfo();
if (TextUtils.isEmpty(userInfo)) {
if (TextUtils.isEmpty(userInfo)
&& (!TextUtils.isEmpty(downloadRequest.getUsername())
|| !TextUtils.isEmpty(downloadRequest.getPassword()))) {
userInfo = downloadRequest.getUsername() + ":" + downloadRequest.getPassword();
}
} else {