sanitizer - When modifying SimpleHtmlSanitizer.java, how to deal with <a href=> (Gwt)? -
you know simplehtmlsanitizer.java accepts following markup ("b", "em", "i", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "ul", "ol", "li"). want "u", "sub", "a href=" & don't want "hr", "ul", "ol", "li". need modify class.
now @ simplehtmlsanitizer.java (https://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/safehtml/shared/simplehtmlsanitizer.java?r=8653) & @ line in class:
arrays.aslist("b", "em", "i", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "ul", "ol", "li"));
you can guess can put our wished list line of code right. modify to:
arrays.aslist("b","i", "u", "h1", "h2", "h3", "h4","a href="));
every tag in list works fine except "a href=". example, when put string test <a href="car.com"><hr>hello</a>
didn't show correct output. correct output should have string <hr>hello
in hyperlink.
so how modify simplehtmlsanitizer in case of<a href=
that because simplehtmlsanitizer
sanitizes attribute-free tags, <a href="">
not. hence have poke simplesanitize()
method allow that. note wasn't mentioned you'd use algorithm in it, , smells not being safe.
Comments
Post a Comment