Bug 479951 - Kmail sometimes deletes saved attachments when opened through KMail interface
Summary: Kmail sometimes deletes saved attachments when opened through KMail interface
Status: REPORTED
Alias: None
Product: kmail2
Classification: Applications
Component: message list (show other bugs)
Version: 5.22.3
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-17 16:32 UTC by NMD
Modified: 2024-04-28 14:11 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot of file deletion dialogue (37.09 KB, image/png)
2024-01-17 16:32 UTC, NMD
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NMD 2024-01-17 16:32:45 UTC
Created attachment 164987 [details]
Screenshot of file deletion dialogue

SUMMARY

Sometimes when right clicking and saving an attachment in kmail, if you click then 'open file' option that appears in the Kmail dialogue, you can view /  edit the file, but on closure Kmail sometimes deletes the file.
Sometimes it will do so with a message giving you the choice to delete the file - which is unexpected and may lead to the wrong user choice - but also at least once it has seemed to delete the file on closure without any user input.

STEPS TO REPRODUCE
1. Open a message in Kmail that has attachment(s), through a single click in the message list
2. Right click, save as on the attachment. Save to disk
3. Click open file in the dialogue that appears (which also allows an 'open folder' option). 
4. Edit file, save/close
5. Kmail / Plasma sometimes presents a dialogue asking if you still wish to delete the 'supposedly temporary file', despite it having been manually saved to user folders.

OBSERVED RESULT
Kmail/KDE sometimes - but not always - presents a dialogue where the default option is to delete the edited file.

EXPECTED RESULT
Closure leaves file unchanged, as it has been saved by the user.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian 12, Kernel version - 6.1.0-17-amd64
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
This bug does not appear on every attempt but has been observed a number of times and carries a risk of data loss.
Comment 1 David Passens 2024-04-28 14:11:59 UTC
This appears to be due to this[0] line in messagelib, where opened files are unconditionally deleted.

[0] https://invent.kde.org/pim/messagelib/-/blob/master/messageviewer/src/widgets/opensavedfilefolderwidget.cpp?ref_type=heads#L75