Explorar o código

fix download file with noascii chars in name

Bartek Przybylski %!s(int64=13) %!d(string=hai) anos
pai
achega
700c9427cd
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      src/eu/alefzero/webdav/WebdavClient.java

+ 6 - 0
src/eu/alefzero/webdav/WebdavClient.java

@@ -75,6 +75,12 @@ public class WebdavClient extends HttpClient {
     public boolean downloadFile(String filepath, File targetPath) {
         // HttpGet get = new HttpGet(mUri.toString() + filepath.replace(" ",
         // "%20"));
+        String[] splitted_filepath = filepath.split("/");
+        filepath = "";
+        for (String s : splitted_filepath) {
+            if (s.equals("")) continue;
+            filepath += "/" + URLEncoder.encode(s);
+        }
 
         Log.e("ASD", mUri.toString() + filepath.replace(" ", "%20") + "");
         GetMethod get = new GetMethod(mUri.toString()