remove file:// on view engine fs walk

This commit is contained in:
Garrett Mills 2020-09-05 10:41:39 -05:00
parent f19adc5bf3
commit 0c4b8c11d7
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

View File

@ -186,10 +186,14 @@ console.log('template path resolved 1', resolved_path)
protected async init_engine_handlebars() {
const partials_dir: unknown = this.config.get('app.views.partials_dir')
if ( String(partials_dir) ) {
const partials_path = this.template_path(String(partials_dir))
let partials_path = this.template_path(String(partials_dir))
console.log({ partials_path, partials_dir })
this.logger.info(`Registering Handlebars partials from: ${partials_path}`)
if ( partials_path.startsWith('file://') ) {
partials_path = partials_path.slice(7)
}
for await ( const entry of fs.walk(partials_path) ) {
if ( !entry.isFile || !entry.path.endsWith(this.get_file_extension()) ) {
if ( entry.isFile ) this.logger.debug(`Skipping file in Handlebars partials path with invalid suffix: ${entry.path}`)