From: masensio Date: Fri, 17 Apr 2015 12:10:41 +0000 (+0200) Subject: Show an error message for invalid server url X-Git-Tag: test~29^2~1 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/eac77d8749e037c0e75a3c9f507409c7441f3cf5?ds=sidebyside Show an error message for invalid server url --- diff --git a/owncloud-android-library b/owncloud-android-library index 9e761387..4692c4aa 160000 --- a/owncloud-android-library +++ b/owncloud-android-library @@ -1 +1 @@ -Subproject commit 9e761387a0b406402684571f28c36c2d6d2b6301 +Subproject commit 4692c4aadeba1d741b2b164af480c929ad4c17e9 diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 1e4e8b4f..d43df3f3 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/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(); diff --git a/src/com/owncloud/android/utils/DisplayUtils.java b/src/com/owncloud/android/utils/DisplayUtils.java index 905f60b2..c18a0e48 100644 --- a/src/com/owncloud/android/utils/DisplayUtils.java +++ b/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;