Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

Fix bug if url contains dot character #140

Closed
wants to merge 2 commits into from
Closed

Fix bug if url contains dot character #140

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Feb 22, 2016

No description provided.

if (this.useRouter) {
name = url.parse(name).path;
if(name.indexOf('.') !== -1){
name += '.jsx';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bodyscripter can you please explain what is being done here? we cannot assume that all files will have jsx extension

@ghost
Copy link
Author

ghost commented Mar 28, 2016

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

@samsel
Copy link
Contributor

samsel commented Mar 28, 2016

but what is the bug here @bodyscripter ?

@ghost
Copy link
Author

ghost commented Mar 28, 2016

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
Copy link
Contributor

samsel commented Mar 28, 2016

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

1 similar comment
@samsel
Copy link
Contributor

samsel commented Mar 28, 2016

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

@ghost
Copy link
Author

ghost commented Mar 28, 2016

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
Copy link
Contributor

samsel commented Mar 28, 2016

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

@ghost
Copy link
Author

ghost commented Mar 28, 2016

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.

@samsel samsel closed this Oct 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant