mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
properly URI-decode file:// URIs, so the files can be found
Fixes issues 63
This commit is contained in:
parent
6e9146c91a
commit
96162b6608
@ -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));
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user