File tree Expand file tree Collapse file tree
src/test/java/org/owasp/html Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -800,6 +800,19 @@ public static final void testLinkRelsWhenRelPresent() {
800800 ));
801801 }
802802
803+ @ Test
804+ public static final void testRelLinksWhenRelisPartOfData () {
805+ PolicyFactory pf = new HtmlPolicyBuilder ()
806+ .allowElements ("a" )
807+ .allowAttributes ("href" ).onElements ("a" )
808+ .allowAttributes ("rel" ).onElements ("a" )
809+ .allowAttributes ("target" ).onElements ("a" )
810+ .allowStandardUrlProtocols ()
811+ .toFactory ();
812+ String toSanitize = "<a target=\" _blank\" rel=\" noopener noreferrer\" href=\" https://google.com\" >test</a>" ;
813+ assertTrue ("Failure in testRelLinksWhenRelisPartOfData" , pf .sanitize (toSanitize ).equals (toSanitize ));
814+ }
815+
803816 @ Test
804817 public static final void testFailFastOnSpaceSeparatedStrings () {
805818 boolean failed ;
You can’t perform that action at this time.
0 commit comments