File tree Expand file tree Collapse file tree
jlmap-api/src/main/java/io/github/makbn/jlmap/model/builder Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,20 +57,22 @@ public String buildJsElement() {
5757 getElementVarName (),
5858 renderOptions (),
5959 lat , lng ,
60- sanitizeContent (),
60+ sanitizeContent (true ),
6161 getElementVarName (),
6262 renderCallbacks ());
6363 }
6464
65- private @ NotNull String sanitizeContent () {
66- return content != null ? "\" " + content .replace ("\" " , "\\ \" " ) + "\" " : "\" \" " ;
65+ private @ NotNull String sanitizeContent (boolean wrap ) {
66+ var sanitized = content != null ? content .replace ("\" " , "\\ \" " )
67+ .replaceAll ("<script[^>]*?>.*?</script>" , "" ) : "" ;
68+ return wrap ? "\" " + sanitized + "\" " : sanitized ;
6769 }
6870
6971 @ Override
7072 public JLPopup buildJLObject () {
7173 return JLPopup .builder ()
7274 .id (uuid )
73- .text (sanitizeContent ())
75+ .text (sanitizeContent (false ))
7476 .latLng (JLLatLng .builder ()
7577 .lat (lat )
7678 .lng (lng )
You can’t perform that action at this time.
0 commit comments