remove file:// on view engine template render

This commit is contained in:
Garrett Mills 2020-09-05 10:46:22 -05:00
parent 0c4b8c11d7
commit c482216565
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
TLS support TLS support
internationalization internationalization
uploads & universal path uploads & universal path!!
CLI - view routes, template generation, start server, directives, output, args CLI - view routes, template generation, start server, directives, output, args
nicer error and home pages nicer error and home pages
favicon favicon

View File

@ -72,7 +72,10 @@ console.log('view engine template dir', { base_dir, template_dir: this.template_
* @return Promise<string> * @return Promise<string>
*/ */
public async template(template_path: string, data: { [key: string]: any } = {}) { public async template(template_path: string, data: { [key: string]: any } = {}) {
const file_path = `${this.template_path(template_path.replace(/:/g, '/'))}${this.get_file_extension()}` let file_path = `${this.template_path(template_path.replace(/:/g, '/'))}${this.get_file_extension()}`
if ( file_path.startsWith('file://') ) {
file_path = file_path.slice(7)
}
this.logger.debug(`Rendering template "${template_path}" from file: ${file_path}`) this.logger.debug(`Rendering template "${template_path}" from file: ${file_path}`)