Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-35669

email-ext-plugin shows HTML entities as plaintext in HTML email output

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • email-ext-plugin
    • None

      In the html output for email-ext, there was a bugfix in version 2.40 regarding the HTML entities.

      In our Setup with version 2.43 and Jenkins version 1.655, we still get the attached output which shows the html entities but does not process them properly.

      So this is not yet fixed in our scenario. Could you have another look, please? Thanks!

          [JENKINS-35669] email-ext-plugin shows HTML entities as plaintext in HTML email output

          Patrick Julian added a comment - - edited

          Anything I can provide here additionally, in order to help?
          (I didn't really get what you meant by your last comment)

          Patrick Julian added a comment - - edited Anything I can provide here additionally, in order to help? (I didn't really get what you meant by your last comment)

          My last comment was saying I am seeing it to

          David van Laatum added a comment - My last comment was saying I am seeing it to

          It looks like its double escaping the entitys. Am thinking of implementing templates in pipeline jobs this weekend so Ill probably attempt to figure this out again as part of that

          David van Laatum added a comment - It looks like its double escaping the entitys. Am thinking of implementing templates in pipeline jobs this weekend so Ill probably attempt to figure this out again as part of that

          Thanks!

          Patrick Julian added a comment - Thanks!

          A temporary workaround is to copy html.jelly in $JENKINS_HOMEemail-templates and apply the following patch :

          diff --git a/src/main/resources/hudson/plugins/emailext/templates/html.jelly b/src/main/resources/hudson/plugins/emailext/templates/html.jelly
          index 4683313..4065668 100644
          --- a/src/main/resources/hudson/plugins/emailext/templates/html.jelly
          +++ b/src/main/resources/hudson/plugins/emailext/templates/html.jelly
          @@ -1,4 +1,7 @@
           <?jelly escape-by-default='true'?>
          +<!DOCTYPE html [
          +    <!ENTITY nbsp "&#38;#38;nbsp&#59;">
          +]>
           <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define">
           
           <STYLE>
          @@ -18,7 +21,6 @@ TD.test_failed { color:red; }
           TD.console { font-family:Courier New; }
           </STYLE>
           <BODY>
          -<j:set var="spc" value="&amp;nbsp;&amp;nbsp;" />
           
           
           <!-- GENERAL INFO -->
          @@ -56,14 +58,14 @@ TD.console { font-family:Courier New; }
                 <j:set var="hadChanges" value="true" />
                 <j:set var="aUser" value="${cs.hudsonUser}"/>
                 <TR>
          -        <TD colspan="2" class="bg2">${spc}Revision <B>${cs.commitId?:cs.revision?:cs.changeNumber}</B> by
          +        <TD colspan="2" class="bg2">&nbsp;&nbsp;Revision <B>${cs.commitId?:cs.revision?:cs.changeNumber}</B> by
                     <B>${aUser!=null?aUser.displayName:cs.author.displayName}: </B>
                     <B>(${cs.msgAnnotated})</B>
                    </TD>
                 </TR>
                 <j:forEach var="p" items="${cs.affectedFiles}">
                   <TR>
          -          <TD width="10%">${spc}${p.editType.name}</TD>
          +          <TD width="10%">&nbsp;&nbsp;${p.editType.name}</TD>
                     <TD>${p.path}</TD>
                   </TR>
                 </j:forEach>
          

          Pierre-Gildas MILLON added a comment - A temporary workaround is to copy html.jelly in $JENKINS_HOMEemail-templates and apply the following patch : diff --git a/src/main/resources/hudson/plugins/emailext/templates/html.jelly b/src/main/resources/hudson/plugins/emailext/templates/html.jelly index 4683313..4065668 100644 --- a/src/main/resources/hudson/plugins/emailext/templates/html.jelly +++ b/src/main/resources/hudson/plugins/emailext/templates/html.jelly @@ -1,4 +1,7 @@ <?jelly escape-by-default='true'?> +<!DOCTYPE html [ + <!ENTITY nbsp "&#38;#38;nbsp&#59;"> +]> <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"> <STYLE> @@ -18,7 +21,6 @@ TD.test_failed { color:red; } TD.console { font-family:Courier New; } </STYLE> <BODY> -<j:set var="spc" value="&amp;nbsp;&amp;nbsp;" /> <!-- GENERAL INFO --> @@ -56,14 +58,14 @@ TD.console { font-family:Courier New; } <j:set var="hadChanges" value="true" /> <j:set var="aUser" value="${cs.hudsonUser}"/> <TR> - <TD colspan="2" class="bg2">${spc}Revision <B>${cs.commitId?:cs.revision?:cs.changeNumber}</B> by + <TD colspan="2" class="bg2">&nbsp;&nbsp;Revision <B>${cs.commitId?:cs.revision?:cs.changeNumber}</B> by <B>${aUser!=null?aUser.displayName:cs.author.displayName}: </B> <B>(${cs.msgAnnotated})</B> </TD> </TR> <j:forEach var="p" items="${cs.affectedFiles}"> <TR> - <TD width="10%">${spc}${p.editType.name}</TD> + <TD width="10%">&nbsp;&nbsp;${p.editType.name}</TD> <TD>${p.path}</TD> </TR> </j:forEach>

          Thanks pgmillon! That actually looks good Ill apply and release that

          David van Laatum added a comment - Thanks pgmillon ! That actually looks good Ill apply and release that

          Code changed in jenkins
          User: David van Laatum
          Path:
          src/main/resources/hudson/plugins/emailext/templates/html.jelly
          http://jenkins-ci.org/commit/email-ext-plugin/ad60d8e4cc1f1f608591cfbaea541ffe12e22fbc
          Log:
          JENKINS-35669   being double escaped in changesets table of jelly html email template

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: David van Laatum Path: src/main/resources/hudson/plugins/emailext/templates/html.jelly http://jenkins-ci.org/commit/email-ext-plugin/ad60d8e4cc1f1f608591cfbaea541ffe12e22fbc Log: JENKINS-35669   being double escaped in changesets table of jelly html email template

          ver 2.45 released

          David van Laatum added a comment - ver 2.45 released

          Leonid Lee added a comment -

          Hello,

          Our jenkins is 1.651.3

          editable mail notification plugin is 2.46

          but I still get such error.

          I use html-with-health-and-console.jelly template

           

          Is there any workaround?

           

           

          Leonid Lee.

           

           

          Leonid Lee added a comment - Hello, Our jenkins is 1.651.3 editable mail notification plugin is 2.46 but I still get such error. I use html-with-health-and-console.jelly template   Is there any workaround?     Leonid Lee.    

          Leonid Lee added a comment - - edited

          Ok, I applied workaround to html-with-health-and-console.jelly similar to mentioned above by @Pierre-Gildas MILLON and it worked.

          Leonid Lee added a comment - - edited Ok, I applied workaround to html-with-health-and-console.jelly similar to mentioned above by @Pierre-Gildas MILLON and it worked.

            davidvanlaatum David van Laatum
            dmc_pp Patrick Julian
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: