astroidmail / astroid

A graphical threads-with-tags style, lightweight and fast, e-mail client for Notmuch
http://astroidmail.github.io
Other
606 stars 65 forks source link

Can't open HTML parts #737

Open rothn opened 10 months ago

rothn commented 10 months ago

Since I'm copying some from https://github.com/astroidmail/astroid/issues/19, I will bold the original parts. It seems I feel much the same way as OP so I'll let them do (most) of the talking:

Hi,

I've just started using Astroid but I really like it so far, so thanks!

I can't seem to open HTML parts though. I've tried pressing o or enter after navigating to the alternative part with j/k with the email selected but this just opens up a search box. I have "open_html_part_external": "true", in my config and i've set "open_external_link" to point to Firefox (also tried it with the default xdg-open which is installed an I've tested from the command line). I also have the default "external_open_cmd": "xdg-open".

The text for the external part says "Alternative part (type: text/html) - potentially sketchy." but there doesn't seem to be any way to open it once highlighted (or ideally show html by default)

I'm sure I'm missing something obvious but I've run out of ideas, sorry!

rothn commented 10 months ago

If I set "preferred_type": "html" in the config file, I can get the very top of HTML emails to load, but it's usually just the header (e.g. stylized "INSIDE DAILY BRIEF") without the content.

rothn commented 10 months ago

Rebasing onto https://github.com/ibuclaw/astroid/tree/remove_iframes fixes the display issue where only the top of the emails load, but I still have the original issue of not being able to open a selected part. Please advise as to a fix. For now, I am just setting html as my preferred type as a workaround but I really would like to be able to open other parts of multipart messages, like attachments.

jorsn commented 1 month ago
  1. Do I understand correctly that you cannot even open attachments?
  2. Does any part of the problem show up if you set open_html_part_external to false? (given you applied #740 or #747; you can check out pull requests locally)
jorsn commented 2 weeks ago

I cannot reproduce this completely. When I press 'o', after navigating to the alternative part, it opens the search box. When I press enter, it opens firefox with the correct html file, which has however already been deleted by astroid. So, for me, this seems to be the actual issue:

When Astroid opens a attachment and the external program detaches (runs in the background), then astroid deletes the cached file. But how do we get around this? How can astroid know that the file isn't being displayed any more?

jorsn commented 2 weeks ago

I once tried something with inotifywait, but for me, everything seems to be fixed if I set attachment.external_open_cmd to the following shell script

#!/usr/bin/env bash

xdg-open "$1"
sleep 1s

Thus, firefox can read the file before the process exits and astroid deletes the file.

@rothn If you still encounter the issue, please write so. For now, I will not consider this for the new release (#750).