Bug 471938 - User files with default "untitled" name are deleted when using "save as" function
Summary: User files with default "untitled" name are deleted when using "save as" func...
Status: RESOLVED INTENTIONAL
Alias: None
Product: ghostwriter
Classification: Applications
Component: general (show other bugs)
Version: 23.04.2
Platform: Neon Linux
: NOR critical
Target Milestone: ---
Assignee: megan.conkle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-04 11:26 UTC by Riccardo Robecchi
Modified: 2024-07-06 22:56 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Riccardo Robecchi 2023-07-04 11:26:58 UTC
SUMMARY
Since at least the update to version 23.04.2, ghostwriter appears to delete user files when saving them with a new name. I have witnessed this behaviour when saving a file with a new name: the old file is deleted from the disk. It is not even moved to the recycling bin, it is simply removed altogether. This means the user can, and will, lose their data.

STEPS TO REPRODUCE
1. Open a file.
2. Save it with a new name in a different directory.

OBSERVED RESULT
The file you opened is deleted.

EXPECTED RESULT
The file you opened is left intact.

SOFTWARE/OS VERSIONS
Linux: KDE neon
KDE Plasma Version: 5.27.6
KDE Frameworks Version: 5.107.0
Qt Version: 5.15.10

ADDITIONAL INFORMATION
Comment 1 megan.conkle 2023-07-26 07:59:39 UTC
I cannot reproduce this error.  When you say you are "saving" the file, are you using "Rename" or "Save As" from the File menu in the menu bar?  If rename, then it is expected behavior that the old file is moved (not deleted) to the new name/location.  I'm not losing work on my end.  Would you please clarify the steps to reproduce the issue?

Thanks!
Comment 2 megan.conkle 2023-07-26 08:00:28 UTC
Needs more info for triaging.  See previous comment.
Comment 3 Riccardo Robecchi 2023-07-26 15:32:16 UTC
I thought "saving the file with a new name" was a clear enough reference to the use of "save as". Sorry for the confusion.
Comment 4 Riccardo Robecchi 2023-07-30 17:06:15 UTC
One additional thing I have noticed, and which might be related, is that using the "save" function (ctrl+s) opens the save dialogue to give the file a name even when the file already exists, so there seems to be no option to just overwrite the currently-opened file. Is this the intended behaviour? Would this be correlated to the bug at hand?
Comment 5 Riccardo Robecchi 2023-09-13 15:00:51 UTC
After more testing, I realised that this bug arises when the files have one of the default names: untitled-$number.md. In that case they are deleted when you save with a "proper" file name, and the ctrl+s shortcut brings up a save dialogue. While I understand the reasoning behind this, this seems to be a consequence of bug 460352. I would say that as long as temporary files are saved in the Documents directory, there is no reason not to treat them like "normal" files.