Changed OCFile to keep mRemotePath as a valid URL; CLEAR YOUR CACHE AFTER INSTALLING
[pub/Android/ownCloud.git] / src / eu / alefzero / webdav / WebdavClient.java
index a8d22ce..907de67 100644 (file)
@@ -21,7 +21,6 @@ import java.io.BufferedInputStream;
 import java.io.File;\r
 import java.io.FileOutputStream;\r
 import java.io.IOException;\r
-import java.net.URLEncoder;\r
 \r
 import org.apache.commons.httpclient.Credentials;\r
 import org.apache.commons.httpclient.HttpClient;\r
@@ -71,19 +70,23 @@ public class WebdavClient extends HttpClient {
                 new EasySSLSocketFactory(), 443));\r
     }\r
 \r
-    public boolean downloadFile(String filepath, File targetPath) {\r
+    public boolean downloadFile(String remoteFilepath, File targetPath) {\r
         // HttpGet get = new HttpGet(mUri.toString() + filepath.replace(" ",\r
         // "%20"));\r
-        String[] splitted_filepath = filepath.split("/");\r
-        filepath = "";\r
+        /* dvelasco - this is not necessary anymore; OCFile.mRemotePath (the origin of remoteFielPath) keeps valid URL strings\r
+        String[] splitted_filepath = remoteFilepath.split("/");\r
+        remoteFilepath = "";\r
         for (String s : splitted_filepath) {\r
             if (s.equals("")) continue;\r
-            filepath += "/" + URLEncoder.encode(s);\r
+            remoteFilepath += "/" + URLEncoder.encode(s);\r
         }\r
 \r
-        Log.e("ASD", mUri.toString() + filepath.replace(" ", "%20") + "");\r
+        Log.e("ASD", mUri.toString() + remoteFilepath.replace(" ", "%20") + "");\r
         GetMethod get = new GetMethod(mUri.toString()\r
-                + filepath.replace(" ", "%20"));\r
+                + remoteFilepath.replace(" ", "%20"));\r
+        */\r
+        \r
+        GetMethod get = new GetMethod(mUri.toString() + remoteFilepath);\r
 \r
         // get.setHeader("Host", mUri.getHost());\r
         // get.setHeader("User-Agent", "Android-ownCloud");\r
@@ -155,8 +158,7 @@ public class WebdavClient extends HttpClient {
 \r
     public boolean createDirectory(String path) {\r
         try {\r
-            MkColMethod mkcol = new MkColMethod(mUri.toString() + "/" + path\r
-                    + "/");\r
+            MkColMethod mkcol = new MkColMethod(mUri.toString() + path);\r
             int status = executeMethod(mkcol);\r
             Log.d(TAG, "Status returned " + status);\r
             Log.d(TAG, "uri: " + mkcol.getURI().toString());\r