Uploaded image for project: 'Apache Knox'
  1. Apache Knox
  2. KNOX-623

Gateway provider rewriter doesn't support boolean attributes in HTML.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.6.0
    • None
    • None

    Description

      When enabling 'rewrite' on a service it fails to correctly parse HTML with boolean attributes.

      According to w3 it is valid for attributes to not have values, they are known as boolean attributes (see link below). The current implementation of the html filter rewriter fails to parse boolean attributes which results in those attributes being assigned a value of null instead of remaining a boolean attribute.

      http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#boolean-attributes

      Here's an additional unit test for HtmlFilterReaderBaseTest that shows the problem.

      @Test
      	public void testBooleanAttribute() throws IOException, ParserConfigurationException
      	{
      		String inputXml = "<html ng-app=\"angularapp\" ng-controller=\"AppCtrl\" role=\"application\" aria-labelledBy=\"title\">\n" + "<head>\n"
      				+ "<title id=\"title\" ng-bind=\"pageTitle\"></title>\n" + "</head>\n" + "<body>\n" + "<div class=\"container\">\n" + "<div ui-view></div>\n"
      				+ "</div>\n" + "</body>\n" + "</html>\n";
      
      		StringReader inputReader = new StringReader(inputXml);
      		HtmlFilterReaderBase filterReader = new NoopXmlFilterReader(inputReader);
      		String outputHtml = new String(IOUtils.toCharArray(filterReader));
      		assertEquals(inputXml, outputHtml);
      	}
      

      Attachments

        1. KNOX-623.patch
          4 kB
          Christopher Jackson

        Activity

          People

            jackson Christopher Jackson
            jackson Christopher Jackson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: