diff --git a/FAQ.md b/FAQ.md
index b04a274bc6..d8e3575776 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -860,10 +860,11 @@ so you'll need to select one account to be the primary account and/or you'll nee
**(49) How can I fix 'An outdated app sent a file path instead of a file stream' ?**
-You likely selected or sent an attachment or image with an outdated file manager or an outdated app that assumes all apps still have storage permissions.
+You likely selected or sent an attachment or image with an outdated file manager
+or an outdated app which assumes all apps still have storage permissions.
For security and privacy reasons modern apps like FairEmail have no full access to all files anymore.
This can result into the error message *An outdated app sent a file path instead of a file stream*
-when a file name instead of a file stream is presented to FairEmail.
+if a file name instead of a file stream is being shared with FairEmail because FairEmail cannot randomly open files.
You can fix this by switching to an up-to-date file manager or an app designed for recent Android versions.
Alternatively, you can grant FairEmail read access to the storage space on your device in the Android app settings.
diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java
index 6939c37ae8..6c6261557d 100644
--- a/app/src/main/java/eu/faircode/email/FragmentCompose.java
+++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java
@@ -1244,8 +1244,8 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
// External app sending absolute file
- if (ex instanceof IllegalArgumentException)
- Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
+ if (ex instanceof SecurityException)
+ handleFileShare();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
}
@@ -1330,7 +1330,7 @@ public class FragmentCompose extends FragmentBase {
if ("file".equals(uri.getScheme()) &&
!Helper.hasPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE)) {
Log.w("Add attachment uri=" + uri);
- throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
+ throw new SecurityException();
}
EntityAttachment attachment = new EntityAttachment();
@@ -1862,14 +1862,34 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
+ pbWait.setVisibility(View.GONE);
+
// External app sending absolute file
- if (ex instanceof IllegalArgumentException)
- Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
+ if (ex instanceof SecurityException)
+ handleFileShare();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
}
};
+ void handleFileShare() {
+ final Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setData(Uri.parse("https://github.com/M66B/open-source-email/blob/master/FAQ.md#user-content-faq49"));
+ boolean resolves = (intent.resolveActivity(getContext().getPackageManager()) != null);
+
+ Snackbar sb = Snackbar.make(view,
+ R.string.title_no_stream,
+ resolves ? Snackbar.LENGTH_INDEFINITE : Snackbar.LENGTH_LONG);
+ if (resolves)
+ sb.setAction(R.string.title_info, new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ startActivity(intent);
+ }
+ });
+ sb.show();
+ }
+
private SimpleTask actionLoader = new SimpleTask() {
int last_available = 0;
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4fe84b1669..e15b353f01 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -501,6 +501,7 @@
Undo
Add
Browse
+ Info
Report
Do not ask this again
Adobe Acrobat reader cannot open safely shared files, see the FAQ for more information