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

Can't open HTML parts #737

Open
rothn opened this issue Sep 8, 2023 · 5 comments
Open

Can't open HTML parts #737

rothn opened this issue Sep 8, 2023 · 5 comments

Comments

@rothn
Copy link
Contributor

rothn commented Sep 8, 2023

Since I'm copying some from #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
Copy link
Contributor Author

rothn commented Sep 8, 2023

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
Copy link
Contributor Author

rothn commented Sep 8, 2023

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
Copy link
Member

jorsn commented May 31, 2024

  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 Remove enable-frame-flattening and iframe for message body #740 or set iframe height in javascript #747; you can check out pull requests locally)

@jorsn jorsn mentioned this issue Jun 5, 2024
6 tasks
@jorsn
Copy link
Member

jorsn commented Jun 29, 2024

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
Copy link
Member

jorsn commented Jun 29, 2024

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).

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