GithubHelp home page GithubHelp logo

Comments (5)

javaarch4u avatar javaarch4u commented on July 24, 2024

Hi @choffware! I am facing same problem, Please let me know if you were able to resolve it. Thanks in advance!

from antisamy.

davewichers avatar davewichers commented on July 24, 2024

Hey @choffware and @javaarch4u. I can't reproduce this misbehavior in either the SAX or DOM parsers. Can you give me more details on your exact setup so I can reproduce? This is the test case I wrote to try to reproduce this:

    @Test
    public void testGithubIssue23() throws ScanException, PolicyException {
    	String test23 = "<ul><li>one</li><li>two</li><li>three<ul><li>a</li><li>b</li></ul></li></ul>";
    	// Issue indicates you end up with this:
    	//    <ul><li>one</li><li>two</li><li>three<ul></ul></li><li>a</li><li>b</li></ul>
    	// Meaning the <li>a</li><li>b</li> elements were moved outside of the nested <ul> list they were in    	
    	// The a.replaceAll("\\s","") is used to strip out all the whitespace in the CleanHTML so we can successfully find
    	// what we expect to find.
        assertThat(as.scan(test23, policy, AntiSamy.SAX).getCleanHTML().replaceAll("\\s",""), containsString("<ul><li>a</li>"));
        assertThat(as.scan(test23, policy, AntiSamy.DOM).getCleanHTML().replaceAll("\\s",""), containsString("<ul><li>a</li>"));
    }

I've actually checked in this test case into the 1.5.8 branch on github, so you can run it yourself. The 1.5.8 branch includes a bunch of library upgrades but I doubt that would have any affect on this test.

from antisamy.

davewichers avatar davewichers commented on July 24, 2024

Given that two different people have indicated they are seeing this misbehavior, we are going to leave this open for a while. Can you guys let us know your setup that replicates this bug?

from antisamy.

javaarch4u avatar javaarch4u commented on July 24, 2024

Thanks for looking in to this Dave! I appreciate it! I was actually able to identify the root cause of this problem. When there is tika parser’s dependency; boilerpipe.jar; in the classpath, antisamy loads faulty classes from boilerpipe.jar instead of nekohtml jar file. When i removed boilerpipe jar dependency from my project, everything worked as expected.

from antisamy.

davewichers avatar davewichers commented on July 24, 2024

Thanks for the reply! And the solution to your problem. Hopefully, if @choffware sees this, he has the same or a similar issue, and can fix his setup too. I'm going to close this as its not an AntiSamy bug.

from antisamy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.