Skip to content

in PDF, Body is empty with certain emails, because the function processStyleTags(html) breaks the </style> ending tag #18

@emmanueljarri

Description

@emmanueljarri

With some emails, when a style tag is present (ex : <style type="text/css">) the function processStyleTags(html)
would NOT catch and keep the end tag </style> in a group, and then would catch a position number and would replace the end tag </style> with the location number, thus breaking the HTML syntax, thus implying a blank body in the generated PDF.

This is the original regex , with the wrongfully "NO CATCH" instruction :

return html.replace(/(<style[^>]*>)(.*?)(?:<\/style>)/gi, function(m, tag, style, end) {

This is the one modified to DO CATCH the ending tag </style> so it's correctly stored in the "end" variable and then correctly put back at the end : (without the non capturing "?:" :

return html.replace(/(<style[^>]*>)(.*?)(<\/style>)/gi, function(m, tag, style, end) {

Now for me it does generate the PDF correctly for emails with <style> tag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions