mirror of https://github.com/M66B/FairEmail.git
Check for null URIs
This commit is contained in:
parent
1f449c9e58
commit
8f46bdebd1
|
@ -172,13 +172,17 @@ public class ActivityEML extends ActivityBase {
|
|||
new SimpleTask<File>() {
|
||||
@Override
|
||||
protected File onExecute(Context context, Bundle args) throws Throwable {
|
||||
Uri uri = args.getParcelable("uri");
|
||||
|
||||
if (uri == null)
|
||||
throw new FileNotFoundException();
|
||||
|
||||
File dir = new File(getCacheDir(), "shared");
|
||||
if (!dir.exists())
|
||||
dir.mkdir();
|
||||
|
||||
File file = new File(dir, "email.eml");
|
||||
|
||||
Uri uri = args.getParcelable("uri");
|
||||
Helper.copy(context, uri, file);
|
||||
return file;
|
||||
}
|
||||
|
@ -489,6 +493,9 @@ public class ActivityEML extends ActivityBase {
|
|||
protected Void onExecute(Context context, Bundle args) throws Throwable {
|
||||
Uri uri = args.getParcelable("uri");
|
||||
|
||||
if (uri == null)
|
||||
throw new FileNotFoundException();
|
||||
|
||||
if (!"content".equals(uri.getScheme())) {
|
||||
Log.w("Save attachment uri=" + uri);
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
|
||||
|
|
|
@ -19,6 +19,8 @@ package eu.faircode.email;
|
|||
Copyright 2018-2021 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import static eu.faircode.email.ServiceAuthenticator.AUTH_TYPE_GMAIL;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Dialog;
|
||||
import android.app.NotificationChannel;
|
||||
|
@ -107,8 +109,6 @@ import javax.crypto.SecretKeyFactory;
|
|||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
|
||||
import static eu.faircode.email.ServiceAuthenticator.AUTH_TYPE_GMAIL;
|
||||
|
||||
public class ActivitySetup extends ActivityBase implements FragmentManager.OnBackStackChangedListener {
|
||||
private View view;
|
||||
private DrawerLayout drawerLayout;
|
||||
|
@ -571,6 +571,10 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) throws Throwable {
|
||||
Uri uri = args.getParcelable("uri");
|
||||
|
||||
if (uri == null)
|
||||
throw new FileNotFoundException();
|
||||
|
||||
String password = args.getString("password");
|
||||
EntityLog.log(context, "Exporting " + uri);
|
||||
|
||||
|
@ -799,6 +803,9 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|||
" answers=" + import_answers +
|
||||
" settings=" + import_settings);
|
||||
|
||||
if (uri == null)
|
||||
throw new FileNotFoundException();
|
||||
|
||||
if (!"content".equals(uri.getScheme()) &&
|
||||
!Helper.hasPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE)) {
|
||||
Log.w("Import uri=" + uri);
|
||||
|
@ -1403,6 +1410,9 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|||
Uri uri = args.getParcelable("uri");
|
||||
Log.i("Import certificate uri=" + uri);
|
||||
|
||||
if (uri == null)
|
||||
throw new FileNotFoundException();
|
||||
|
||||
boolean der = false;
|
||||
String extension = Helper.getExtension(uri.getLastPathSegment());
|
||||
Log.i("Extension=" + extension);
|
||||
|
|
|
@ -19,6 +19,9 @@ package eu.faircode.email;
|
|||
Copyright 2018-2021 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import static android.app.ActionBar.DISPLAY_SHOW_CUSTOM;
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
import android.app.RecoverableSecurityException;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.BroadcastReceiver;
|
||||
|
@ -65,9 +68,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static android.app.ActionBar.DISPLAY_SHOW_CUSTOM;
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
public class FragmentBase extends Fragment {
|
||||
private String title = null;
|
||||
private String subtitle = " ";
|
||||
|
@ -477,6 +477,9 @@ public class FragmentBase extends Fragment {
|
|||
long id = args.getLong("id");
|
||||
Uri uri = args.getParcelable("uri");
|
||||
|
||||
if (uri == null)
|
||||
throw new FileNotFoundException();
|
||||
|
||||
if (!"content".equals(uri.getScheme())) {
|
||||
Log.w("Save attachment uri=" + uri);
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
|
||||
|
@ -552,6 +555,9 @@ public class FragmentBase extends Fragment {
|
|||
long id = args.getLong("id");
|
||||
Uri uri = args.getParcelable("uri");
|
||||
|
||||
if (uri == null)
|
||||
throw new FileNotFoundException();
|
||||
|
||||
if (!"content".equals(uri.getScheme())) {
|
||||
Log.w("Save attachment uri=" + uri);
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
|
||||
|
|
|
@ -2503,6 +2503,9 @@ public class FragmentCompose extends FragmentBase {
|
|||
int requestCode = args.getInt("requestCode");
|
||||
Uri uri = args.getParcelable("uri");
|
||||
|
||||
if (uri == null)
|
||||
throw new FileNotFoundException();
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean suggest_names = prefs.getBoolean("suggest_names", true);
|
||||
|
||||
|
|
|
@ -6542,6 +6542,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
long id = args.getLong("id");
|
||||
Uri uri = args.getParcelable("uri");
|
||||
|
||||
if (uri == null)
|
||||
throw new FileNotFoundException();
|
||||
|
||||
if (!"content".equals(uri.getScheme())) {
|
||||
Log.w("Save raw uri=" + uri);
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
|
||||
|
|
|
@ -19,6 +19,8 @@ package eu.faircode.email;
|
|||
Copyright 2018-2021 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
|
@ -62,8 +64,6 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
public class FragmentRules extends FragmentBase {
|
||||
private long account;
|
||||
private int protocol;
|
||||
|
@ -323,6 +323,9 @@ public class FragmentRules extends FragmentBase {
|
|||
long fid = args.getLong("folder");
|
||||
Uri uri = args.getParcelable("uri");
|
||||
|
||||
if (uri == null)
|
||||
throw new FileNotFoundException();
|
||||
|
||||
if (!"content".equals(uri.getScheme())) {
|
||||
Log.w("Export uri=" + uri);
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
|
||||
|
@ -387,6 +390,9 @@ public class FragmentRules extends FragmentBase {
|
|||
long fid = args.getLong("folder");
|
||||
Uri uri = args.getParcelable("uri");
|
||||
|
||||
if (uri == null)
|
||||
throw new FileNotFoundException();
|
||||
|
||||
if (!"content".equals(uri.getScheme()) &&
|
||||
!Helper.hasPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE)) {
|
||||
Log.w("Import uri=" + uri);
|
||||
|
|
Loading…
Reference in New Issue