Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-6909

Improve HTMLRepairer/HtmlCleaner so that it doesn't throw NullPointerException on an unconfigured element

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 2.22.15, 2.24.01
    • None

    Description

      To reproduce:

      • configure HtmlCleaner, and explicitlely forget to configure <div> element
      • paste an HTML containing a <div> in a Richtext input

      Expexcted: HtmlRepairer will break on line 518:
      String[] allowedAttributes = template.getDescriptors().get(startElement.localName).getAttributeNames();

      Fix: I think this behavior is confusing for the end user, you would rather expect that the cleaner removes every tags he is configured for, and leaves the remaining HTML tags alone.
      Additionally, it could log an INFO, telling that some encountered tags are not configured.

      Attachments

        Activity

          People

            jsheriff Junaidh Kadhar Sheriff
            obourgeois Olivier Bourgeois (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: