hydroxide icon indicating copy to clipboard operation
hydroxide copied to clipboard

text/plain being lost

Open samhh opened this issue 5 years ago • 9 comments

I'm using Hydroxide with aerc and noticed that none of the emails I read are coming through as text/plain, even if the header in the ProtonMail web UI says Content-Type: text/plain. I've run Hydroxide with -debug and am seeing the following:

NteoSA UID STORE 2078 +FLAGS.SILENT (\Seen)
2020/07/30 13:53:07 >> PUT /api/messages/read
2020/07/30 13:53:07 {"IDs":["REDACTED"]}
2020/07/30 13:53:07 << PUT /api/messages/read
2020/07/30 13:53:07 &protonmail.resp{Code:1001, RawAPIError:(*protonmail.RawAPIError)(nil)}
2020/07/30 13:53:07 >> GET /api/events/REDACTED
2020/07/30 13:53:07 << GET /api/events/REDACTED
2020/07/30 13:53:07 &struct { protonmail.resp; *protonmail.Event }{resp:protonmail.resp{Code:1000, RawAPIError:(*protonmail.RawAPIError)(nil)}, Event:(*protonmail.Event)(0xc000182d80)}
NteoSA OK UID STORE completed
HTCrwQ UID FETCH 2078 (ENVELOPE UID BODYSTRUCTURE FLAGS BODY.PEEK[1.MIME] BODY[1])
2020/07/30 13:53:07 >> GET /api/messages/REDACTED
2020/07/30 13:53:07 << GET /api/messages/REDACTED
2020/07/30 13:53:07 &struct { protonmail.resp; Message *protonmail.Message }{resp:protonmail.resp{Code:1000, RawAPIError:(*protonmail.RawAPIError)(nil)}, Message:(*protonmail.Message)(0xc000682d80)}
2020/07/30 13:53:07 >> GET /api/messages/REDACTED
2020/07/30 13:53:07 << GET /api/messages/REDACTED
2020/07/30 13:53:07 &struct { protonmail.resp; Message *protonmail.Message }{resp:protonmail.resp{Code:1000, RawAPIError:(*protonmail.RawAPIError)(nil)}, Message:(*protonmail.Message)(0xc000703980)}
* 2078 FETCH (ENVELOPE ("Wed, 29 Jul 2020 21:49:25 +0100" "REDACTED" (("REDACTED" NIL "forwarding-noreply" "REDACTED")) () () ((NIL NIL "REDACTED" "REDACTED")) () () "" "REDACTED") UID 2078 BODYSTRUCTURE (("text" "html" () NIL NIL "quoted-printable" 0 0 NIL ("inline" ()) NIL NIL) "mixed" NIL NIL NIL NIL) FLAGS (\Seen) BODY[1.MIME] {73}
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain

 BODY[1] {1686}
REDACTED
)
HTCrwQ OK UID FETCH completed
2lf9uQ UID FETCH 2078 (BODYSTRUCTURE ENVELOPE INTERNALDATE FLAGS UID BODY.PEEK[HEADER])
* 2078 FETCH (BODYSTRUCTURE (("text" "html" () NIL NIL "quoted-printable" 0 0 NIL ("inline" ()) NIL NIL) "mixed" NIL NIL NIL NIL) ENVELOPE ("Wed, 29 Jul 2020 21:49:25 +0100" "REDACTED" (("REDACTED" NIL "forwarding-noreply" "REDACTED")) () () ((NIL NIL "REDACTED" "REDACTED")) () () "" "REDACTED") INTERNALDATE "29-Jul-2020 21:49:25 +0100" FLAGS (\Seen) UID 2078 BODY[HEADER] {406}
Content-Type: multipart/mixed;
 boundary=REDACTED
Message-Id: REDACTED
To: <REDACTED>
From: "REDACTED" <REDACTED>
Subject: REDACTED
Date: Wed, 29 Jul 2020 21:49:25 +0100

)
2lf9uQ OK UID FETCH completed

Is this a bug or am I missing something obvious? :slightly_smiling_face: Cheers.

samhh avatar Jul 30 '20 13:07 samhh

Might be a bug. But ProtonMail only keeps the text/html part when an email contains both text/plain and text/html, so maybe that's related too.

emersion avatar Aug 17 '20 09:08 emersion

ah, that's my issue as well, the one from the aerc-list

changing the default from "text/html" to "text/plain" "fixed" it for me: https://github.com/emersion/hydroxide/blob/86db01792a9ca03fc06c67a973c5ba35be878736/imap/message.go#L110

of course, that's probably not completely satisfactory a solution as Proton's default seems to be text/html.

perhaps we could leave the "list message" code as is (so, leaving msg.MIMEType=="" and a body structure with "text/html") but then, when protonmail.Client.GetMessage(id) comes along, update the MIMEType field with the correct value in the db?

or perhaps there's a way to tell the Proton server to give more informations?

sbinet avatar Dec 08 '20 13:12 sbinet

circling back to this. I've been using the patch from #129 since Jan 2021. it's working ok for some messages but not for all.

perhaps a better course of action would be to escalate this to Proton?

sbinet avatar Feb 24 '21 09:02 sbinet

What happens when it doesn't work? Is it showing HTML content with the text/plain MIME type, or the other way around? Or maybe it's just showing HTML content with text/html?

emersion avatar Feb 26 '21 22:02 emersion

In my case, in aerc, both text/plain and text/html (as described in the web UI headers) are detected/rendered as text/html.

samhh avatar Feb 27 '21 16:02 samhh

ditto. kind of. for example, "even with my patch" (for whatever value one may want to attach to this :P), mails from the lists.sr.ht lists get still labeled as text/html.

sbinet avatar Feb 28 '21 13:02 sbinet

Worth noting that I don't see this issue with a Migadu account so this is probably a Hydroxide/PM issue rather than an aerc issue.

samhh avatar Mar 30 '21 15:03 samhh

I still have this problem, text/plain emails are being treated as text/html, which is screwing with the formatting. Any update on a fix?

WyntrHeart avatar Apr 19 '24 20:04 WyntrHeart