X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/d8e0387aef0b538c31cf095fd9637472bb9a0572..12c00057e7a4b279ad245d54d906e74a899aec4b:/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java diff --git a/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java b/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java index b08c3ab6..ec4def42 100644 --- a/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java +++ b/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java @@ -22,7 +22,6 @@ import java.io.BufferedReader; import java.io.File; import java.io.InputStreamReader; import java.lang.Thread.UncaughtExceptionHandler; -import java.net.URLEncoder; import java.util.ArrayList; import android.accounts.Account; @@ -223,11 +222,12 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements AccountUtils.getCurrentOwnCloudAccount(this)); String remotepath = new String(); for (int j = mDirectories.getCount() - 2; j >= 0; --j) { - remotepath += "/" + URLEncoder.encode(mDirectories.getItem(j)); + remotepath += "/" + mDirectories.getItem(j); } if (!remotepath.endsWith("/")) remotepath += "/"; - remotepath += URLEncoder.encode(new File(filepath).getName()); + remotepath += new File(filepath).getName(); + remotepath = Uri.encode(remotepath, "/"); i.putExtra(FileUploader.KEY_LOCAL_FILE, filepath); i.putExtra(FileUploader.KEY_REMOTE_FILE, remotepath); @@ -309,9 +309,10 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements // Clear intent extra, so rotating the screen will not return us to this directory getIntent().removeExtra(FileDetailFragment.EXTRA_FILE); - } else { - mCurrentDir = mStorageManager.getFileByPath("/"); } + + if (mCurrentDir == null) + mCurrentDir = mStorageManager.getFileByPath("/"); // Drop-Down navigation and file list restore mDirectories = new CustomArrayAdapter(this, R.layout.sherlock_spinner_dropdown_item); @@ -416,19 +417,17 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements // Figure out the path where the dir needs to be created String path; if (mCurrentDir == null) { + // this is just a patch; we should ensure that mCurrentDir never is null if (!mStorageManager.fileExists("/")) { OCFile file = new OCFile("/"); mStorageManager.saveFile(file); - mCurrentDir = mStorageManager.getFileByPath("/"); - } else { - Log.wtf("FileDisplay", "OMG NO!"); - return; } + mCurrentDir = mStorageManager.getFileByPath("/"); } path = FileDisplayActivity.this.mCurrentDir.getRemotePath(); // Create directory - path += directoryName + "/"; + path += Uri.encode(directoryName) + "/"; Thread thread = new Thread(new DirectoryCreator(path, a)); thread.start();