From: masensio Date: Mon, 10 Jun 2013 07:01:39 +0000 (+0200) Subject: OC-208: suffix remote.php/webdav. OC-34 X-Git-Tag: oc-android-1.4.3~20^2~1 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/883e1b1674f00bd4325617ec31e2946d4bac5542 OC-208: suffix remote.php/webdav. OC-34 --- diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 13ffd2a9..9ea2a627 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -110,7 +110,8 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList public static final byte ACTION_CREATE = 0; public static final byte ACTION_UPDATE_TOKEN = 1; - + public static final String WEBDAV_PATH= "/remote.php/webdav"; + private String mHostBaseUrl; private OwnCloudVersion mDiscoveredVersion; @@ -426,7 +427,7 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList private void checkOcServer() { - String uri = mHostUrlInput.getText().toString().trim(); + String uri = trimUrlWebdav(mHostUrlInput.getText().toString().trim()); mServerIsValid = false; mServerIsChecked = false; mOkButton.setEnabled(false); @@ -641,15 +642,29 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList } else { url = "http://" + url; } - } + + // OC-208: Add suffix remote.php/webdav to normalize (OC-34) + url = trimUrlWebdav(url); + if (url.endsWith("/")) { url = url.substring(0, url.length() - 1); } + } + Log_OC.d(TAG, "URL Normalize " + url); return (url != null ? url : ""); } + + private String trimUrlWebdav(String url){ + if(url.toLowerCase().endsWith(WEBDAV_PATH)){ + url = url.substring(0, url.length() - WEBDAV_PATH.length()); + } + return (url != null ? url : ""); + } + + /** * Chooses the right icon and text to show to the user for the received operation result. *