From 883e1b1674f00bd4325617ec31e2946d4bac5542 Mon Sep 17 00:00:00 2001 From: masensio Date: Mon, 10 Jun 2013 09:01:39 +0200 Subject: [PATCH] OC-208: suffix remote.php/webdav. OC-34 --- .../authentication/AuthenticatorActivity.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) 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. * -- 2.11.0