expressjs / expressjs/express

`ext` should be case-insensitive for view engines.

Open
#4,594 3 comments 1 reaction 0 assignees View on GitHub
ideas
Dominant language
JavaScript
Stars
69.5k
Forks
25k
Avg merge
4d 20h
Merged PRs (30d)
9

Description

Actually, in issue https://github.com/expressjs/express/issues/4593, I provided _Express_ the `import`ed view engine instance.
I registered it as `"Eta"` (`".Eta"` internally), and _Express_ did not use it for `search.eta` (because it was only looking for the `".eta"` one), triggering the undesired automatic `require`.

```javascript
app.engine("Eta", Eta.renderFile);
console.log(app.engines); // { '.Eta': [Function: renderFile] }
app.set("view engine", "Eta");
```

```javascript
function View(name, options) {
var opts = options || {};

this.defaultEngine = opts.defaultEngine;
this.ext = extname(name);
console.info("EXPRESS", [name, extname(name)]); // EXPRESS [ 'search.eta', '.eta' ]
this.name = name;
this.root = opts.root;
```

-----

Maybe it should normalize the `ext` to a single case?

https://github.com/expressjs/express/blob/5c4f3e7cc76fed9b42c27cebcdd9d66ef63092f9/lib/application.js#L293-L307

https://github.com/expressjs/express/blob/5c4f3e7cc76fed9b42c27cebcdd9d66ef63092f9/lib/view.js#L52-L88

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.