css4j / echosvg

SVG implementation in the Java™ Language, fork of Apache Batik, supporting level 4 selectors and colors.
Apache License 2.0
39 stars 2 forks source link

Transcoder disallows valid script media types #56

Closed carlosame closed 2 years ago

carlosame commented 2 years ago

The transcoder keeps a list of allowed script media types based on the KEY_ALLOWED_SCRIPT_TYPES hint, which by default is:

"text/ecmascript, application/ecmascript, text/javascript, application/javascript, application/java-archive"

Note the whitespaces after the commas. Given to how it is parsed, the mime types are stored with a whitespace at the beginning, resulting in only the first item of the list actually matching the contains mime type check:

https://github.com/css4j/echosvg/blob/8016a5cd342dc16cfc25827ddd96d82e7a496e22/echosvg-transcoder/src/main/java/io/sf/carte/echosvg/transcoder/SVGAbstractTranscoder.java#L1094

As a result, valid script media types are not allowed.