Browse Source

Handled unnames attachments

main
M66B 6 years ago
parent
commit
f4970a0aa5
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      app/src/main/java/eu/faircode/email/AdapterAttachment.java

+ 3
- 3
app/src/main/java/eu/faircode/email/AdapterAttachment.java View File

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


Loading…
Cancel
Save