Skip to content

fix(view): avoid opaque TypeError for view names ending in "." - #7393

Open
Errr0rr404 wants to merge 1 commit into
expressjs:masterfrom
Errr0rr404:fix/view-trailing-dot-opaque-error
Open

fix(view): avoid opaque TypeError for view names ending in "."#7393
Errr0rr404 wants to merge 1 commit into
expressjs:masterfrom
Errr0rr404:fix/view-trailing-dot-opaque-error

Conversation

@Errr0rr404

Copy link
Copy Markdown

Summary

  • path.extname('index.') returns '.', so the view engine loader called require('') and threw ERR_INVALID_ARG_VALUE before lookup could fail cleanly.
  • Skip engine loading when the extension body is empty so app.render returns the usual Failed to lookup view error.

Fixes #7350

Test plan

  • Added test: name ending in "." yields helpful lookup error

path.extname('index.') returns '.', so the engine loader called
require('') and threw ERR_INVALID_ARG_VALUE before lookup could fail
cleanly. Skip loading when the extension body is empty so app.render
returns the usual "Failed to lookup view" error instead.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

res.render()/app.render() throws opaque TypeError for a view name ending in "."

1 participant