Fix incorrect handling of HTML comments in messages sanitization code (#1489904)