deltachat / deltachat-desktop

Email-based instant messaging for Desktop.
GNU General Public License v3.0
948 stars 169 forks source link

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

Open menthenchocolat opened 3 days ago

menthenchocolat commented 3 days ago
Hocuri commented 1 day ago

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)