mirror of https://github.com/M66B/FairEmail.git
Better handle sharing absolute file names
This commit is contained in:
parent
795f9a729d
commit
f0acd00c30
5
FAQ.md
5
FAQ.md
|
@ -860,10 +860,11 @@ so you'll need to select one account to be the primary account and/or you'll nee
|
||||||
<a name="faq49"></a>
|
<a name="faq49"></a>
|
||||||
**(49) How can I fix 'An outdated app sent a file path instead of a file stream' ?**
|
**(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.
|
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*
|
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.
|
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.
|
Alternatively, you can grant FairEmail read access to the storage space on your device in the Android app settings.
|
||||||
|
|
||||||
|
|
|
@ -1244,8 +1244,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
@Override
|
@Override
|
||||||
protected void onException(Bundle args, Throwable ex) {
|
protected void onException(Bundle args, Throwable ex) {
|
||||||
// External app sending absolute file
|
// External app sending absolute file
|
||||||
if (ex instanceof IllegalArgumentException)
|
if (ex instanceof SecurityException)
|
||||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
handleFileShare();
|
||||||
else
|
else
|
||||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||||
}
|
}
|
||||||
|
@ -1330,7 +1330,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
if ("file".equals(uri.getScheme()) &&
|
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);
|
Log.w("Add attachment uri=" + uri);
|
||||||
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
|
throw new SecurityException();
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityAttachment attachment = new EntityAttachment();
|
EntityAttachment attachment = new EntityAttachment();
|
||||||
|
@ -1862,14 +1862,34 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onException(Bundle args, Throwable ex) {
|
protected void onException(Bundle args, Throwable ex) {
|
||||||
|
pbWait.setVisibility(View.GONE);
|
||||||
|
|
||||||
// External app sending absolute file
|
// External app sending absolute file
|
||||||
if (ex instanceof IllegalArgumentException)
|
if (ex instanceof SecurityException)
|
||||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
handleFileShare();
|
||||||
else
|
else
|
||||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
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<EntityMessage> actionLoader = new SimpleTask<EntityMessage>() {
|
private SimpleTask<EntityMessage> actionLoader = new SimpleTask<EntityMessage>() {
|
||||||
int last_available = 0;
|
int last_available = 0;
|
||||||
|
|
||||||
|
|
|
@ -501,6 +501,7 @@
|
||||||
<string name="title_undo">Undo</string>
|
<string name="title_undo">Undo</string>
|
||||||
<string name="title_add">Add</string>
|
<string name="title_add">Add</string>
|
||||||
<string name="title_browse">Browse</string>
|
<string name="title_browse">Browse</string>
|
||||||
|
<string name="title_info">Info</string>
|
||||||
<string name="title_report">Report</string>
|
<string name="title_report">Report</string>
|
||||||
<string name="title_no_ask_again">Do not ask this again</string>
|
<string name="title_no_ask_again">Do not ask this again</string>
|
||||||
<string name="title_no_adobe">Adobe Acrobat reader cannot open safely shared files, see the FAQ for more information</string>
|
<string name="title_no_adobe">Adobe Acrobat reader cannot open safely shared files, see the FAQ for more information</string>
|
||||||
|
|
Loading…
Reference in New Issue