Skip to content

Using a property called "settings" in the data passed to a view/template breaks the lib #153

Description

@tomsotte

Using a property called "settings" in the data passed to a view/template breaks the app.
As far as I've investigated the settings property is used by hbs.js in the middleware function.
If the data passed to the render function of view.js contains alreayd a property settings is doesn't get used correctly, and some information is missing, particularly the view directories (view_dirs in hbs.js).

I'm using hbs as a template engine for expressjs. It all starts as a call for res.render():

...
res.render('settings', { settings: {...} });
...

The error calls stack in detail:

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:28:11)
    at Object.join (path.js:1236:7)
    at /app/node_modules/hbs/lib/hbs.js:117:26
    at Array.map (<anonymous>)
    at Instance.middleware (/app/node_modules/hbs/lib/hbs.js:115:46)
    at View.render (/app/node_modules/express/lib/view.js:135:8)
    at tryRender (/app/node_modules/express/lib/application.js:641:10)
    at Function.render (/app/node_modules/express/lib/application.js:593:3)
    at ServerResponse.render (/app/node_modules/express/lib/response.js:1008:7)
    at exports.get (/app/routes/controllers/settings.js:30:6)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions