]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: html2text: do not parse entity when quote_level > 0.
authorSergey Kitov <sergey.kitov@open-xchange.com>
Tue, 13 Mar 2018 14:36:44 +0000 (16:36 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 17 Apr 2018 07:59:31 +0000 (10:59 +0300)
&entities inside blockquotes are added to text, while other text is
not, this leads to strange results.

src/lib-mail/mail-html2text.c

index fe05ea729d24bd6e4c9b3adf8a01f1621ad3baef..41aee623b9c7fd55d5cf2b70938731020b659442 100644 (file)
@@ -192,13 +192,15 @@ parse_data(struct mail_html2text *ht,
                                if (ret == 0)
                                        return i;
                                i += ret - 1;
-                       } else if (c == '&') {
-                               ret = parse_entity(data+i+1, size-i-1, output);
-                               if (ret == 0)
-                                       return i;
-                               i += ret - 1;
                        } else if (ht->quote_level == 0) {
-                               buffer_append_c(output, c);
+                               if (c == '&') {
+                                       ret = parse_entity(data+i+1, size-i-1, output);
+                                       if (ret == 0)
+                                               return i;
+                                       i += ret - 1;
+                               } else {
+                                       buffer_append_c(output, c);
+                               }
                        }
                        break;
                case HTML_STATE_TAG: