瀏覽代碼

Show an error message for invalid server url

masensio 10 年之前
父節點
當前提交
eac77d8749

+ 1 - 1
owncloud-android-library

@@ -1 +1 @@
-Subproject commit 9e761387a0b406402684571f28c36c2d6d2b6301
+Subproject commit 4692c4aadeba1d741b2b164af480c929ad4c17e9

+ 5 - 3
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -380,7 +380,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             findViewById(R.id.hostUrlFrame).setVisibility(View.GONE);
             mRefreshButton = findViewById(R.id.centeredRefreshButton);
         }
-        showRefreshButton(mServerIsChecked && !mServerIsValid && 
+        showRefreshButton(mServerIsChecked && !mServerIsValid &&
                 mWaitingForOpId > Integer.MAX_VALUE);
         mServerStatusView = (TextView) findViewById(R.id.server_status_text);
         showServerStatus();
@@ -773,10 +773,12 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         mOkButton.setEnabled(false);
         mServerInfo = new GetServerInfoOperation.ServerInfo();
         showRefreshButton(false);
-        
+
         if (uri.length() != 0) {
             // Handle internationalized domain names
-            uri = DisplayUtils.convertIdn(uri, true);
+            if (!uri.startsWith(".")) {
+                uri = DisplayUtils.convertIdn(uri, true);
+            }
             mServerStatusText = R.string.auth_testing_connection;
             mServerStatusIcon = R.drawable.progress_small;
             showServerStatus();

+ 3 - 3
src/com/owncloud/android/utils/DisplayUtils.java

@@ -266,14 +266,14 @@ public class DisplayUtils {
             } else if (url.indexOf("@") != -1) {
                 hostStart = url.indexOf("@") + "@".length();
             }
-            
+
             int hostEnd = url.substring(hostStart).indexOf("/");
             // Handle URL which doesn't have a path (path is implicitly '/')
             hostEnd = (hostEnd == -1 ? url.length() : hostStart + hostEnd);
-            
+
             String host = url.substring(hostStart, hostEnd);
             host = (toASCII ? IDN.toASCII(host) : IDN.toUnicode(host));
-            
+
             return url.substring(0, hostStart) + host + url.substring(hostEnd);
         } else {
             return url;