Skip to content
  • Alex Vandiver's avatar
    Don't die if HTML → text conversion throws an error · 254e8da9
    Alex Vandiver authored
    HTML::FormatText::WithLinks::AndTables may contain errors which make it
    incapable of rendering the HTML to text.  In the context of templates,
    this led to the outgoing mail being dropped on the floor if the
    conversion failed.  It also showed as errors in the REST interface and
    RSS feed, in attempting to downsample an HTML-only message to plain text
    to display therein.
    
    Expliticly wrap the conversion with an eval to trap fatal errors in the
    HTML::FormatText::WithLinks::AndTables module; in such cases, the method
    returns undef.  In the context of template generation, the presence of
    such a return value is to omit the text/plain part entirely, as email
    clients may be able to generate it even if we are unable to.
    
    It is expected that the new tests may begin to fail if
    HTML::FormatText::WithLinks::AndTables resolves its bug surrounding
    nested tables.  Unfortunately, marking them TODO is difficult because
    they intermix passing and failing tests in mail_ok.
    254e8da9