Deleted attachments but record not saved

Post Reply
swar
Posts: 60
Joined: 19 Dec 2020, 04:11
Name: A.R.
Location: Bratislava

Deleted attachments but record not saved

Post by swar »

What: If a user deletes any file uploaded via field attachments, but does not save the record, the file is deleted from the server, but it is still saved in DB. This results in a bug on record detail where uploaded file is display with size (0) and upload does not work (page displays "File not found").

Where: any entity with field-type attachments

How replicate:
1. Upload any file
2. Save the record
3. Edit the record, delete the field and DO NOT save the record.
4. Refresh the page
5. File is still displayed, but the size is 0 and download is not possible (e.g. Document.pdf (0) - 23.11.2022 18:11). You can check it here: https://pdemo.rukovoditel.pro/3.2/index ... mo_id=1719
User avatar
support
Site Admin
Posts: 6215
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Deleted attachments but record not saved

Post by support »

This is how app works. Records should be saved to apply changes in attachment.
swar
Posts: 60
Joined: 19 Dec 2020, 04:11
Name: A.R.
Location: Bratislava

Re: Deleted attachments but record not saved

Post by swar »

I know, you know it, everybody on this forum knows it, but users do not know. Or they might be just lazy or do not care or change their mind after deleting a file and a lot of other reasons.

Every time users do this, which sometimes happens in the app with a lot of users, it causes the data in the app to be corrupted and damaged like this. In case you have an application used by many users, it is not real to watch all the records manually, resaving records and telling users not to do it.

It would be great if rukovoditel prevented this from happening by itself. Maybe by changing the app either to a) delete data in DB at the same time when files on the server are deleted (ajax?) b) delete files on the server if the record is saved? What do you think?
User avatar
support
Site Admin
Posts: 6215
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Deleted attachments but record not saved

Post by support »

Agree with you. Added in plan to fix this issue.
User avatar
support
Site Admin
Posts: 6215
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Deleted attachments but record not saved

Post by support »

Updated this issue for version 3.3.
So now if attachment deleted in from if it will be delete in record too even user close from without click Save button.
swar
Posts: 60
Joined: 19 Dec 2020, 04:11
Name: A.R.
Location: Bratislava

Re: Deleted attachments but record not saved

Post by swar »

That´s great, thanks a lot for this fix!
Post Reply