1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-25 17:27:00 +00:00

Handled unnames attachments

This commit is contained in:
M66B 2018-08-05 06:08:12 +00:00
parent cb6b1be980
commit f4970a0aa5

View file

@ -54,8 +54,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
private List<EntityAttachment> all = new ArrayList<>();
private List<EntityAttachment> filtered = new ArrayList<>();
public class ViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener {
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
View itemView;
TextView tvName;
TextView tvSize;
@ -100,7 +99,8 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
} else {
// Build file name
final File dir = new File(context.getCacheDir(), "attachments");
final File file = new File(dir, TextUtils.isEmpty(attachment.name) ? "noname" : attachment.name);
final File file = new File(dir, TextUtils.isEmpty(attachment.name)
? "attachment_" + attachment.id : attachment.name);
// https://developer.android.com/reference/android/support/v4/content/FileProvider
Uri uri = FileProvider.getUriForFile(context, "eu.faircode.email", file);