paypal / react-engine

a composite render engine for universal (isomorphic) express apps to render both plain react views and react-router views
Apache License 2.0
1.45k stars 130 forks source link

Fix bug if url contains dot character #140

Closed ghost closed 7 years ago

ghost commented 8 years ago

I know that, but if we don't assume that all files' extension are 'jsx', then it's difficult to fix this bug :|

samsel commented 8 years ago

but what is the bug here @bodyscripter ?

ghost commented 8 years ago

Suppose I have a URL is: http://localhost/profile/body.scripter. I use res.render(req.url, ...), then react-engine will parse URL to the corresponding template file that has '.scripter' as its extension, this will throws a error in the rendering process.

samsel commented 8 years ago

can we make this generic to allow a white listed set of extension then?

samsel commented 8 years ago

can we make this generic to allow a white listed set of extension then?

ghost commented 8 years ago

We can create a white listed set of extension, it works, but we have to modify express/lib/view.js in express module (https://github.com/paypal/react-engine/issues/139,) don't need to update react-engine

samsel commented 8 years ago

can't we do this in lib/expressView.js ?

ghost commented 8 years ago

But I think that the cause of error due to react-engine use res.render with primary parameter is req.url, while primary parameter of express's View function is the name of file that has or doesn't has a extension.