-
Notifications
You must be signed in to change notification settings - Fork 130
If render url contains period "Error: Cannot find module" #52
Comments
The It seems like express view accepts a string path for its first parameter. It tries to parse out the extension of that path and load its templating engine (ex. Is there a reason
|
I replaced the
This uses the |
@reggi is this already taken care of? do you need help with anything? |
@samsel I had some problems with running tests on the code above. I couldn't get it to work so I never put a pull request. |
@reggi you can send a PR to the develop branch. I can help fix tests. |
Please forgive the mess! The last referenced issue is my fork on the |
Hey @samsel I put in a new pull request I copied the latest express view and commented out one line of code. Here's my issue / request in express: expressjs/express#2708 (comment) Alternatively periods can be stripped out and matched to the corresponding route.
In the case above |
@samsel just to confirm react route doesn't change what's rendered based on the url query does it? |
We just hit this as well with a valid URL containing identifiers that have dots: /a/path/to/resources/aaa.bbb.ccc.ddd We have not control over the shape of the ID and it looks like a valid path segment anyway. Is the fix on the way? |
I put a pull request that fixes this and it was never accepted. It augments Note: the main reason this issue happens is because express views / render On Monday, October 5, 2015, dglozic notifications@github.com wrote:
|
Yes, I crawled through the code and saw where it happens. Meanwhile, can react-engine at least catch the error and pass it up to express so that we can get it in this form: res.render(path, settings, function(err, html) { Right now, our code blows up because error is thrown in the view, not in the engine. If we try/catch res.render, do you see something wrong with it? The code seems syncronous, so old school try/catch seems appropriate here. We would at least like to report an error rather than crash the app. |
@dglozic Not sure about how to catch the error. The simple thing here is to check the I'm thinking of a piece of middleware that adds a new method to |
is there any update on this issue? |
When your using express the docs use
res.render(req.url, data)
the following to render the url to react. This is causing an issue anytime there is a period in the url.I have periods in my get parameters and in my route. You can pass
req.path
to pass only the path to the router. There is also periods in the url like/index.html
the error isError: Cannot find module 'html'
.Do I have to escape periods to the url?
res.render(req.url.replace(/\./g, ""), data)
The text was updated successfully, but these errors were encountered: