瀏覽代碼

Consider possible trailing / in input URL in login view

David A. Velasco 10 年之前
父節點
當前提交
a2a34ebf09
共有 1 個文件被更改,包括 15 次插入8 次删除
  1. 15 8
      src/com/owncloud/android/authentication/AuthenticatorActivity.java

+ 15 - 8
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -733,7 +733,10 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             
             Intent getServerInfoIntent = new Intent();
             getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO);
-            getServerInfoIntent.putExtra(OperationsService.EXTRA_SERVER_URL, uri);
+            getServerInfoIntent.putExtra(
+                OperationsService.EXTRA_SERVER_URL, 
+                normalizeUrlSuffix(uri)
+            );
             if (mOperationsServiceBinder != null) {
                 mWaitingForOpId = mOperationsServiceBinder.newOperation(getServerInfoIntent);
             } else {
@@ -1080,16 +1083,20 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
                     url = "http://" + url;
                 }
             }
-            
-            url = trimUrlWebdav(url);
-
-            if (url.endsWith("/")) {
-                url = url.substring(0, url.length() - 1);
-            }
-
+        
+            url = normalizeUrlSuffix(url);
         }
         return (url != null ? url : "");
     }
+    
+    
+    private String normalizeUrlSuffix(String url) {
+        if (url.endsWith("/")) {
+            url = url.substring(0, url.length() - 1);
+        }
+        url = trimUrlWebdav(url);
+        return url;
+    }
 
 
     // TODO remove, if possible