Changed OCFile to keep mRemotePath as a valid URL; CLEAR YOUR CACHE AFTER INSTALLING
[pub/Android/ownCloud.git] / src / eu / alefzero / owncloud / ui / activity / FileDisplayActivity.java
index b08c3ab..25cb714 100644 (file)
@@ -22,7 +22,6 @@ import java.io.BufferedReader;
 import java.io.File;\r
 import java.io.InputStreamReader;\r
 import java.lang.Thread.UncaughtExceptionHandler;\r
-import java.net.URLEncoder;\r
 import java.util.ArrayList;\r
 \r
 import android.accounts.Account;\r
@@ -223,11 +222,12 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
                         AccountUtils.getCurrentOwnCloudAccount(this));\r
                 String remotepath = new String();\r
                 for (int j = mDirectories.getCount() - 2; j >= 0; --j) {\r
-                    remotepath += "/" + URLEncoder.encode(mDirectories.getItem(j));\r
+                    remotepath += "/" + mDirectories.getItem(j);\r
                 }\r
                 if (!remotepath.endsWith("/"))\r
                     remotepath += "/";\r
-                remotepath += URLEncoder.encode(new File(filepath).getName());\r
+                remotepath += new File(filepath).getName();\r
+                remotepath = Uri.encode(remotepath, "/");\r
     \r
                 i.putExtra(FileUploader.KEY_LOCAL_FILE, filepath);\r
                 i.putExtra(FileUploader.KEY_REMOTE_FILE, remotepath);\r
@@ -309,9 +309,10 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
             \r
                 // Clear intent extra, so rotating the screen will not return us to this directory\r
                 getIntent().removeExtra(FileDetailFragment.EXTRA_FILE);\r
-            } else {\r
-                mCurrentDir = mStorageManager.getFileByPath("/");\r
             }\r
+            \r
+            if (mCurrentDir == null)\r
+                mCurrentDir = mStorageManager.getFileByPath("/");\r
                 \r
             // Drop-Down navigation and file list restore\r
             mDirectories = new CustomArrayAdapter<String>(this, R.layout.sherlock_spinner_dropdown_item);\r
@@ -428,7 +429,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
                             path = FileDisplayActivity.this.mCurrentDir.getRemotePath();\r
                             \r
                             // Create directory\r
-                            path += directoryName + "/";\r
+                            path += Uri.encode(directoryName) + "/";\r
                             Thread thread = new Thread(new DirectoryCreator(path, a));\r
                             thread.start();\r
     \r