\r
public static final byte ACTION_CREATE = 0;\r
public static final byte ACTION_UPDATE_TOKEN = 1;\r
-\r
-\r
+ \r
private String mHostBaseUrl;\r
private OwnCloudVersion mDiscoveredVersion;\r
\r
\r
\r
private void checkOcServer() {\r
- String uri = mHostUrlInput.getText().toString().trim();\r
+ String uri = trimUrlWebdav(mHostUrlInput.getText().toString().trim());\r
mServerIsValid = false;\r
mServerIsChecked = false;\r
mOkButton.setEnabled(false);\r
} else {\r
url = "http://" + url;\r
}\r
-\r
}\r
+\r
+ // OC-208: Add suffix remote.php/webdav to normalize (OC-34) \r
+ url = trimUrlWebdav(url);\r
+\r
if (url.endsWith("/")) {\r
url = url.substring(0, url.length() - 1);\r
}\r
+\r
}\r
+ Log_OC.d(TAG, "URL Normalize " + url);\r
return (url != null ? url : "");\r
}\r
\r
+\r
+ private String trimUrlWebdav(String url){ \r
+ if(url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_4_0)){\r
+ url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_4_0.length()); \r
+ } else if(url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_2_0)){\r
+ url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_2_0.length()); \r
+ } else if (url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_1_2)){\r
+ url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_1_2.length()); \r
+ } \r
+ return (url != null ? url : "");\r
+ }\r
+ \r
+ \r
/**\r
* Chooses the right icon and text to show to the user for the received operation result.\r
* \r
\r
finish();\r
\r
- } else {\r
+ } else if (result.isServerFail() || result.isException()) {\r
+ /// if server fail or exception in authorization, the UI is updated as when a server check failed\r
+ mServerIsChecked = true;\r
+ mServerIsValid = false;\r
+ mIsSslConn = false;\r
+ mOcServerChkOperation = null;\r
+ mDiscoveredVersion = null;\r
+ mHostBaseUrl = normalizeUrl(mHostUrlInput.getText().toString());\r
+\r
+ // update status icon and text\r
+ updateServerStatusIconAndText(result);\r
+ showServerStatus();\r
+ mAuthStatusIcon = 0;\r
+ mAuthStatusText = 0;\r
+ showAuthStatus();\r
+ \r
+ // update input controls state\r
+ showRefreshButton();\r
+ mOkButton.setEnabled(false);\r
+\r
+ // very special case (TODO: move to a common place for all the remote operations) (dangerous here?)\r
+ if (result.getCode() == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED) {\r
+ mLastSslUntrustedServerResult = result;\r
+ showDialog(DIALOG_SSL_VALIDATOR); \r
+ }\r
+\r
+ } else { // authorization fail due to client side - probably wrong credentials\r
updateAuthStatusIconAndText(result);\r
showAuthStatus();\r
Log_OC.d(TAG, "Access failed: " + result.getLogMessage());\r