thunderbird / thunderbird/thunderbird-android

Incorrect numbering when saving duplicate attachments for application/octet-stream attachments

Open
#9,141 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
Dominant language
Kotlin
Stars
14k
Forks
2.8k
Avg merge
3d 3h
Merged PRs (30d)
57

Description

Checklist
  • I have used the search function to see if someone else has already submitted the same bug report.
  • I will describe the problem with as much detail as possible.
App

K-9 Mail

App version

9.0

Where did you get the app from?

F-Droid

Android version

Android 15, CalyxOS 6.6.23

Device model

Fairphone 4 (FP4)

Steps to reproduce
  1. Receive a mail with an attachment.
  2. Save that and do it again with another mail with the same attachment (I guess it also works for the same mail).
Expected behavior

Let's say the attachment is named file.pdf. Given a file named file.pdf already exists in the Downloads folder, the file should be named file (2).pdf or similar.

Actual behavior

The file is named file.pdf (1). This is not (actually) (very) funny, but causes problems, because many applications including the built-in file picker of Android do not detect that as a PDF file anymore in that example.
So this breaks a lot of functionality in a subtle way and you have to look twice and have at least basic knowledge about files (notably many people may not have this anymore) to fix it.
Thing is it e.g. may also break images and people could wonder why they don't see saved images in their gallery etc.

Workaround: renaming, of course

Another less erious issue: Notice how it is suffixed with (1)? While this may make sense for technical people, it makes less for everyone else.
I checked how Nautilus (GNOME file manager) does it e.g. when I copy a file in the same dir and it names them file (copy).pdf and even file (second copy).pdf for the second.

And if I copy a file that already exists in the target location (which is likely more similar to the issue at hand), I can rename it and the default suggestion is: file (2).pdf:
Image

IMHO both versions are a better UX.

Logs

k9mail-logs_duplicatefile.txt

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Reproduce saving duplicate application/octet-stream attachments on Android 15, then inspect the attached logs and trace the attachment-saving entry point. Done means duplicate files retain the extension, use the expected numbering, and remain recognized by Android file and gallery tools.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
67/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.