Showing "View as HTML" button more often
Alexey Shpakovsky via squirrelmail-devel <[email protected]> Mon, 20 Jul 2020 01:33:36 +0200
| Newsgroups | gmane.mail.squirrelmail.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello SquirrelMail devs,
First of all, thanks for all the hard work on this long-standing project!
Second, my problem: when reading HTML-only mails, SquirrelMail can render
them both as HTML and in "plaintext converted from HTML by stripping tags"
mode, depending on default preference. That is great, but issue is that
the "View as HTML"/"View as plain text" link to switch between them is not
always there. Sample of HTML email where it's not present is provided at
the end of this message.
I was able to track it down to `true` passed as third argument to
`findDisplayEntity` in read_body.php, line 90 [1]:
if ($message->findDisplayEntity(array(), array('text/html'), true)) {
$has_html = true;
}
In the findDisplayEntity function [2] this argument is called `$strict`
and when set to true it limits what entities it can find.
Hence, my question: Does anyone have any arguments in favour of keeping
this argument as `true`, meaning strict, instead of changing it to more
permissive `false`?
`svn blame` points to the commit [3] titled "Merged View as HTML support
into the SquirrelMail core". Looking at available versions of View as HTML
plugin [4], I see that this `true` appeared between versions 2.7 and 3.2
when migrating from SquirrelMail version 1.2 to 1.4. The only hint I get
from View as HTML plugin is this line in changelogs which appeared long
before this:
> Changed to only show link when there is an alternate part
So maybe the original idea was to show this link only when a message had
both HTML and plaintext versions in order to switch between them.
Can it be changed to show this button always, whenever an HTML part exists?
Example email which doesn't get the "View as HTML/plain text" link:
===============================================
Date: Fri, 17 Jul 2020 04:39:00 -0700 (PDT)
From: AliExpress <[email protected]>
To: [email protected]
Subject: Discounted now: item(s) in your cart!
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_139235128"
------=_Part_139235128
Content-Type: text/html;charset=utf-8
Content-Transfer-Encoding: quoted-printable
this is <b>HTML</b> text!<br>
------=_Part_139235128--
===============================================
Links from the text:
[1]:
https://sourceforge.net/p/squirrelmail/code/HEAD/tree/trunk/squirrelmail/src/read_body.php#l90
[2]:
https://sourceforge.net/p/squirrelmail/code/HEAD/tree/trunk/squirrelmail/class/mime/Message.class.php#l986
[3]: https://sourceforge.net/p/squirrelmail/code/10683
[4]: http://squirrelmail.org/plugin_view.php?id=55
Thanks for consideration,
Aleksei.
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel