-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed template path resolvement to work also on Windows OS. #8284
Conversation
Fixed template path resolvement to work also on Windows OS.
} | ||
TemplateLoader templateLoader = null; | ||
if (config.additionalProperties().get(CodegenConstants.TEMPLATE_DIR) != null) { | ||
templateLoader = new FileTemplateLoader(config.templateDir(), ".mustache"); | ||
templateLoader = new FileTemplateLoader(config.templateDir().replace("\\", "/"), ".mustache"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @thomas-worm-datev, i think this could work but it's not the causes of the issue, i tested locally and when we use a custom templates it crash.
The real issue is this statement:
templateFile = templateFile.replace("\\", "/");
at line 568
if you're agree, please assign permissions to HugoMario
to your repo and i can help sending the fix from your PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @HugoMario,
I first tested with your suggested line, but that solved the problem only partially. I got error that V2\JavaSpring/api.mustache could not be found.
This was caused from the line
final Handlebars handlebars = new Handlebars(templateLoader);
So I found out that even the templateDir path has to be handled with a safe path handling.
Best Regards,
Thomas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if that line is the issue, try using a custom templates in a windows OS with your changes and you'll see my point.
thanks a lot @thomas-worm-datev !!! |
No description provided.