You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I do a request that store a dot character, e.x: http://localhost/profile/abc.xyz. Then, nodejs will notify 'error: uncaughtException: Cannot find module 'xyz'. I know it occur due to the ReactEngineView function in the react-engine/lib/expressView.js, in depth the ReactEngineView function will call the View function at express/lib/view.js. The View function as the following code:
function View(name, options) {
var opts = options || {};
this.defaultEngine = opts.defaultEngine;
this.ext = extname(name); // <--------- Error here
this.name = name;
this.root = opts.root;
if (!this.ext && !this.defaultEngine) {
throw new Error('No default engine was specified and no extension was provided.');
}
var fileName = name;
if (!this.ext) {
// get extension from default engine name
this.ext = this.defaultEngine[0] !== '.'
? '.' + this.defaultEngine
: this.defaultEngine;
fileName += this.ext;
}
console.log(this.ext);
if (!opts.engines[this.ext]) {
// load engine
opts.engines[this.ext] = require(this.ext.substr(1)).__express;
}
// store loaded engine
this.engine = opts.engines[this.ext];
// lookup path
this.path = this.lookup(fileName);
}
When I do a request that store a dot character, e.x: http://localhost/profile/abc.xyz. Then, nodejs will notify 'error: uncaughtException: Cannot find module 'xyz'. I know it occur due to the ReactEngineView function in the react-engine/lib/expressView.js, in depth the ReactEngineView function will call the View function at express/lib/view.js. The View function as the following code: