diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2022-02-26 18:30:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-26 18:30:56 +0100 |
commit | 7a207ce870a18591462a71d05424d12dd55992d2 (patch) | |
tree | 021988a19d9dd1c32280aceb10bb9baf3d7dc837 /core/src | |
parent | 0c1e0b85851da0e33042a7cb567b996a584774af (diff) | |
parent | 11d44f71405146ef2854b933526a6a741fc36b56 (diff) | |
download | AntennaPod-7a207ce870a18591462a71d05424d12dd55992d2.zip |
Merge pull request #5752 from ByteHamster/fix-credentials-colon
Fix credentials with colon
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java b/core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java index 667d6afeb..fff2eb25b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java @@ -59,14 +59,15 @@ public class BasicAuthorizationInterceptor implements Interceptor { return response; } - String[] parts = userInfo.split(":"); - if (parts.length != 2) { + if (!userInfo.contains(":")) { Log.d(TAG, "Invalid credentials for '" + request.url() + "'"); return response; } + String username = userInfo.substring(0, userInfo.indexOf(':')); + String password = userInfo.substring(userInfo.indexOf(':') + 1); Log.d(TAG, "Authorization failed, re-trying with ISO-8859-1 encoded credentials"); - String credentials = HttpDownloader.encodeCredentials(parts[0], parts[1], "ISO-8859-1"); + String credentials = HttpDownloader.encodeCredentials(username, password, "ISO-8859-1"); newRequest.header(HEADER_AUTHORIZATION, credentials); response = chain.proceed(newRequest.build()); @@ -75,7 +76,7 @@ public class BasicAuthorizationInterceptor implements Interceptor { } Log.d(TAG, "Authorization failed, re-trying with UTF-8 encoded credentials"); - credentials = HttpDownloader.encodeCredentials(parts[0], parts[1], "UTF-8"); + credentials = HttpDownloader.encodeCredentials(username, password, "UTF-8"); newRequest.header(HEADER_AUTHORIZATION, credentials); return chain.proceed(newRequest.build()); } |