Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attachmentfiles on devices are rw - changes to attachements are not signaled to the user by DeltaChat #4352

Open
menthenchocolat opened this issue Nov 23, 2024 · 1 comment

Comments

@menthenchocolat
Copy link

  • Operating System (Linux/Mac/Windows/iOS/Android): Linux

  • Delta Chat Version: 1.48

  • Expected behavior:
    If I click on an attachment (e.g. a LibreOffice document) sent to me via DeltaChat, DeltaChat either prompts me to save this to some folder on my device, or the attachment is opened directly in e.g. LibreOffice, but LibreOffice tells me, that the file is read-only and needs to be saved somewhere else before I can edit it.

  • Actual behavior:
    I click on an attachment in DeltaChat, attachment is opened directly in e.g. LibreOffice and I can edit & save directly to the attachment file in the DeltaChat storage location. Thus data between me and sender becomes inconsistent. DeltaChat does not inform me about the edited attachment.
    Still worse is what happened to a friend of mine: He edited the document, saved it. The save was persistent, but only for a day or so. Then the changes in the document got reverted (by DeltaChat?) to the original version.

  • Steps to reproduce the problem:
    Open attachment in DeltaChat, edit, save (not "save as ..." but "save"). Then: reopen in DeltaChat. Edit is persistent, meaning attachment is not anymore in the state it was sent. DeltaChat does not inform user about this.
    I was unable to reproduce the worse version on my machine. I believe what happened on my friends machine was due to him using a mail-server setup different from mine (him using the default DeltaChat-Server, me using my own mail provider).

  • Screenshots: -

  • Logs: -

  • Comment: I know that one should save attachments to a different location before editing them, but there are many NOOBS out there and DeltaChats behaviour (see above) will get a lot of them in trouble. They should be able to use DeltaChat safely, I believe.

@Hocuri
Copy link

Hocuri commented Nov 25, 2024

The two possible ways to fix this problem: (the nicest user experience would be to implement them both)

  1. When the user clicks on an attachment to open it:

    • Copy the attachment file to a temporary directory. The MessageObject returned by get_message(…) includes a file_name, which should be used as the name.
    • Open the new, temporary file instead of the original.

    Make sure that the temporary directory is cleaned afterwards.

  2. Set the file as read-only before opening it externally, e.g. by removing the "w" bit on Linux or by opening the file on Windows (IIRC an "opened" file is automatically read-only on Windows)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants