properly URI-decode file:// URIs, so the files can be found

Fixes issues 63
This commit is contained in:
Thialfihar 2010-08-17 12:50:42 +00:00
parent 6e9146c91a
commit 96162b6608
4 changed files with 4 additions and 4 deletions

View File

@ -50,7 +50,7 @@ public class DataSource {
if (mContentUri != null) {
if (mContentUri.getScheme().equals("file")) {
// get the rest after "file://"
String path = mContentUri.toString().substring(6);
String path = Uri.decode(mContentUri.toString().substring(7));
if (path.startsWith(Environment.getExternalStorageDirectory().getAbsolutePath())) {
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
throw new GeneralException(context.getString(R.string.error_externalStorageNotReady));

View File

@ -217,7 +217,7 @@ public class DecryptActivity extends BaseActivity {
} else if (Apg.Intent.DECRYPT_FILE.equals(mIntent.getAction())) {
mInputFilename = mIntent.getDataString();
if ("file".equals(mIntent.getScheme())) {
mInputFilename = mInputFilename.substring(6);
mInputFilename = Uri.decode(mInputFilename.substring(7));
}
mFilename.setText(mInputFilename);
guessOutputFilename();

View File

@ -349,7 +349,7 @@ public class EncryptActivity extends BaseActivity {
}
} else if (Apg.Intent.ENCRYPT_FILE.equals(mIntent.getAction())) {
if ("file".equals(mIntent.getScheme())) {
mInputFilename = mIntent.getDataString().replace("file://", "");
mInputFilename = Uri.decode(mIntent.getDataString().replace("file://", ""));
mFilename.setText(mInputFilename);
guessOutputFilename();
}

View File

@ -102,7 +102,7 @@ public class KeyListActivity extends BaseActivity {
Intent intent = getIntent();
if (Apg.Intent.IMPORT.equals(intent.getAction())) {
if ("file".equals(intent.getScheme()) && intent.getDataString() != null) {
mImportFilename = intent.getDataString().replace("file://", "");
mImportFilename = Uri.decode(intent.getDataString().replace("file://", ""));
} else {
mImportData = intent.getStringExtra(Apg.EXTRA_TEXT);
}