Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
9.12.0
-
None
Description
The JavaScriptStripper fails to accurately detect regular expressions in some cases.
In the example below it fails to switch into the REG_EXP state at 'return/[', and will then switch to LINE_COMMENT state when parsing '//', which will then lead to the entire rest of the JavaScript code to be cut off, making the code unparseable by the client.
return/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(t);}}
An example of a webjar containing javascript, that will trigger the bug can be found here: https://search.maven.org/artifact/org.webjars.npm/summernote/0.8.20/jar - also see attached JS files below.
Current workaround is to disable compression:
getResourceSettings().setJavaScriptCompressor(null);