Skip to content

Temporary file gets deleted too soon? #100

Description

@haasn

I often find myself opening certain HTML emails in the browser, with "xdg-open&". I noticed that there is some delay (around a second) before the browser tab actually gets opened. (Only for these emails, for some reason) When this happens, bower has usually already deleted the temporary file by the time xdg-open has identified the file and forwarded it to the browser.

Obviously, the real bug here is that "xdg-open" takes too long on these files, for unknown reasons. But I think it's still bad UX from the side of bower for me to have to wait for the attachment to finish opening at all, before I can press away the message.

I think it would be better for bower to keep them around, either for a set amount of time, or until program exit. (I don't usually keep my mail client open when I'm not expecting mail, personally)

Activity

  1. haasn commented on Mar 5, 2022

    @haasn
    ContributorAuthor

    It seems to be reproducible with practically any HTML file:

    $ echo '<html><body>Example</body></html>' > example
    $ time xdg-open example
    xdg-open example  0.48s user 0.13s system 102% cpu 0.599 total
    $ time firefox example
    firefox example  0.05s user 0.02s system 73% cpu 0.101 total
    

    So it definitely is an xdg-open bug as well.

  2. haasn commented on Mar 5, 2022

    @haasn
    ContributorAuthor

    Another possible solution:

    Add the possibility of detecting HTML MIME types (text/html) and opening them with the open_url command instead of the open_part command by default. Then I can just point open_url at firefox& and circumvent xdg-open.

  3. added a commit that references this issue on Mar 5, 2022
    9260f59
  4. wangp commented on Mar 5, 2022

    @wangp
    Owner

    A simple solution is to defer deleting all temporary files until we leave the thread view. I've mocked it up on the defer-rm-temp branch.

    A question is when opening a part with a foreground command, i.e. without a trailing &, should the temporary file be deleted as soon as the command returns. That assumes the command only returns once the user is done viewing the part, which I guess would not be true if you use xdg-open to launch a web browser. On the other hand, email parts are small and keeping them around for a little longer doesn't really hurt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions