Merge branch 'master' of gitorious.org:owncloud/android-devel
authorBartek Przybylski <bart.p.pl@gmail.com>
Tue, 26 Jun 2012 16:08:49 +0000 (18:08 +0200)
committerBartek Przybylski <bart.p.pl@gmail.com>
Tue, 26 Jun 2012 16:08:49 +0000 (18:08 +0200)
src/eu/alefzero/owncloud/datamodel/OCFile.java
src/eu/alefzero/owncloud/files/services/InstantUploadService.java
src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java
src/eu/alefzero/webdav/WebdavClient.java

index 3a720b9..ca454d1 100644 (file)
@@ -60,7 +60,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
     public OCFile(String path) {
         resetData();
         mNeedsUpdating = false;
-        // dvelasco: let's make mandatory that mRemotePath is a valid URL always; this will make our life easier with the URL-encoding/decoding
+        /// dvelasco: the encoding / decoding problem should be completely translated to WebdavClient & WebdavEntry, but at this moment we are in a little hurry
         if (path != null && path.length() > 0) {
             try {
                 new URL("http://silly.test.com:8888" + path);
@@ -68,7 +68,8 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
                 throw new RuntimeException("Trying to create a OCFile with a non valid remote path: " + path , e);
             }
         } else throw new RuntimeException("Trying to create a OCFile with a non valid remote path: " + path);
-        mRemotePath = path;
+        // save encoded paths have a problem: normalization; this is a quick&dirty fix to avoid duplications
+        mRemotePath = Uri.encode(Uri.decode(path), "/");
     }
 
     /**
index 8c8ee31..9ac0411 100644 (file)
@@ -148,7 +148,7 @@ public class InstantUploadService extends Service {
                 try {
                     status = wdc.executeMethod(mkcol);
                     Log.e(TAG, "mkcol returned " + status);
-                    wdc.putFile(filepath, INSTANT_UPLOAD_DIR + "/" + filename, mimetype);
+                    wdc.putFile(filepath, INSTANT_UPLOAD_DIR + "/" + Uri.encode(filename), mimetype);
                 } catch (HttpException e) {
                     e.printStackTrace();
                 } catch (IOException e) {
index d19cd3c..ec4def4 100644 (file)
@@ -106,7 +106,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
 \r
         // TODO: fix hack: workaround for bug in actionbar sherlock\r
         // it always shows indeterminate progress bar\r
-        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {\r
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {\r
             requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);\r
             setProgressBarIndeterminateVisibility(false);\r
         }\r
@@ -417,14 +417,12 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
                             // Figure out the path where the dir needs to be created\r
                             String path;\r
                             if (mCurrentDir == null) {\r
+                                // this is just a patch; we should ensure that mCurrentDir never is null\r
                                 if (!mStorageManager.fileExists("/")) {\r
                                     OCFile file = new OCFile("/");\r
                                     mStorageManager.saveFile(file);\r
-                                    mCurrentDir = mStorageManager.getFileByPath("/");\r
-                                } else {\r
-                                    Log.wtf("FileDisplay", "OMG NO!");\r
-                                    return;\r
                                 }\r
+                                mCurrentDir = mStorageManager.getFileByPath("/");\r
                             }\r
                             path = FileDisplayActivity.this.mCurrentDir.getRemotePath();\r
                             \r
index 907de67..0a231c0 100644 (file)
@@ -85,7 +85,6 @@ public class WebdavClient extends HttpClient {
         GetMethod get = new GetMethod(mUri.toString()\r
                 + remoteFilepath.replace(" ", "%20"));\r
         */\r
-        \r
         GetMethod get = new GetMethod(mUri.toString() + remoteFilepath);\r
 \r
         // get.setHeader("Host", mUri.getHost());\r