Small improvements

This commit is contained in:
M66B 2019-05-14 12:12:13 +02:00
parent 1efe675abd
commit b2e445c04b
3 changed files with 13 additions and 3 deletions

View File

@ -19,6 +19,7 @@ package eu.faircode.email;
Copyright 2018-2019 by Marcel Bokhorst (M66B)
*/
import android.Manifest;
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
@ -71,8 +72,11 @@ public class ActivityDSN extends ActivityBase {
protected Result onExecute(Context context, Bundle args) throws Throwable {
Uri uri = args.getParcelable("uri");
if ("file".equals(uri.getScheme()))
if ("file".equals(uri.getScheme()) &&
!Helper.hasPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE)) {
Log.w("DSN uri=" + uri);
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
}
Result result = new Result();

View File

@ -19,6 +19,7 @@ package eu.faircode.email;
Copyright 2018-2019 by Marcel Bokhorst (M66B)
*/
import android.Manifest;
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
@ -85,8 +86,11 @@ public class ActivityEml extends ActivityBase {
protected Result onExecute(Context context, Bundle args) throws Throwable {
Uri uri = args.getParcelable("uri");
if ("file".equals(uri.getScheme()))
if ("file".equals(uri.getScheme()) &&
!Helper.hasPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE)) {
Log.w("EML uri=" + uri);
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
}
Result result = new Result();

View File

@ -1744,8 +1744,10 @@ public class FragmentCompose extends FragmentBase {
Log.w("Add attachment uri=" + uri);
if ("file".equals(uri.getScheme()) &&
!Helper.hasPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE))
!Helper.hasPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE)) {
Log.w("Add attachment uri=" + uri);
throw new SecurityException();
}
EntityAttachment attachment = new EntityAttachment();