Forráskód Böngészése

Use UTF_8 for basic authorization

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 1 éve
szülő
commit
e5788016cf

+ 7 - 3
app/src/main/java/com/nextcloud/talk/dagger/modules/RestModule.java

@@ -40,6 +40,7 @@ import java.io.IOException;
 import java.net.CookieManager;
 import java.net.InetSocketAddress;
 import java.net.Proxy;
+import java.nio.charset.StandardCharsets;
 import java.security.KeyStore;
 import java.security.KeyStoreException;
 import java.security.NoSuchAlgorithmException;
@@ -209,9 +210,12 @@ public class RestModule {
             if (appPreferences.getProxyCredentials() &&
                     !TextUtils.isEmpty(appPreferences.getProxyUsername()) &&
                     !TextUtils.isEmpty(appPreferences.getProxyPassword())) {
-                httpClient.proxyAuthenticator(new HttpAuthenticator(Credentials.basic(
-                        appPreferences.getProxyUsername(),
-                        appPreferences.getProxyPassword()), "Proxy-Authorization"));
+                httpClient.proxyAuthenticator(new HttpAuthenticator(
+                    Credentials.basic(
+                    appPreferences.getProxyUsername(),
+                    appPreferences.getProxyPassword(),
+                    StandardCharsets.UTF_8),
+                    "Proxy-Authorization"));
             }
         }
 

+ 2 - 1
app/src/main/java/com/nextcloud/talk/utils/ApiUtils.java

@@ -34,6 +34,7 @@ import com.nextcloud.talk.data.user.model.User;
 import com.nextcloud.talk.models.RetrofitBucket;
 import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew;
 
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -399,7 +400,7 @@ public class ApiUtils {
         if (TextUtils.isEmpty(username) && TextUtils.isEmpty(token)) {
             return null;
         }
-        return Credentials.basic(username, token);
+        return Credentials.basic(username, token, StandardCharsets.UTF_8);
     }
 
     public static String getUrlNextcloudPush(String baseUrl) {