openapi-contrib / openapi3-generator

Use your API OpenAPI 3 definition to generate code, documentation, and literally anything you need.
Apache License 2.0
89 stars 27 forks source link

Wrong output location, if template path contains special characters #32

Closed richardklose closed 4 years ago

richardklose commented 5 years ago

If the project path contains special characters, the code for creating the target_file path in generator.js (line 100 and following) doesn't work as intended.

e.g. if the paths look like this:

template path:  /some+dir/project/templates/some-file
templates root: /some+dir/project/templates

the replacement of /some+dir/project/templates in the template file path doesn't work, because the + is interpreted as a regular expression instruction.

I think all special chars for regular expressions should be escaped here.