ssrwpo / ssr

SSR - Router with SSR for Node & Meteor
https://ssrwpo.github.io/ssr/
MIT License
93 stars 16 forks source link

Urls with . or ' fail to load #74

Closed s7dhansh closed 7 years ago

s7dhansh commented 7 years ago

I think some regex match would be causing it. I can create a PR is someone can point me to the file.

PEM-- commented 7 years ago

URLs with ' are invalid and therefore should not be processed.

PEM-- commented 7 years ago

URLs with . are processed by Meteor itself.

s7dhansh commented 7 years ago

This is the error I am getting when the url has a ..

Uncaught Error: _registerComponent(...): Target container is not a DOM element.
    at invariant (modules.js?hash=6617641…:14910)
    at Object._renderNewRootComponent (modules.js?hash=6617641…:78999)
    at Object._renderSubtreeIntoContainer (modules.js?hash=6617641…:79089)
    at render (modules.js?hash=6617641…:79110)
    at createRouter.jsx:79
    at maybeReady (meteor.js?hash=27829e9…:809)
    at HTMLDocument.loadingCompleted (meteor.js?hash=27829e9…:821)
invariant @ modules.js?hash=6617641…:14910
_renderNewRootComponent @ modules.js?hash=6617641…:78999
_renderSubtreeIntoContainer @ modules.js?hash=6617641…:79089
render @ modules.js?hash=6617641…:79110
(anonymous) @ createRouter.jsx:79
maybeReady @ meteor.js?hash=27829e9…:809
loadingCompleted @ meteor.js?hash=27829e9…:821

Seems to be a ssrwpo bug to me.

Without . it works fine.

PEM-- commented 7 years ago

Seems fine to me. You're trying to access an undeclared URL on Meteor itself with a .. As mentioned, URLs with . are processed by Meteor itself. Avoid creating your routes with a ..

PS: I'm not even sure that URL with . except on domain names and extensions are valid URLs 🤔

s7dhansh commented 7 years ago

I agree with you on and I generally avoid such urls. But we can't control what the user is going to enter. If someone enters a url with a dot or any random character for that matter, I would not want my app to fail, but to rather display a graceful error page.

Can you please explain -

You're trying to access an undeclared URL on Meteor itself with a .

From what I can comprehend, Meteor is passing the url to createRouter.jsx and the problems seems to be coming there.

With another app, that does not use ssr, uses FlowRouter (client), such urls works fine.

cbilotta commented 7 years ago

I can't reproduce the bug ... Can you give an example ?

s7dhansh commented 7 years ago

@iRayzer In the demo itself, use a dot in the url. eg. http://localhost:3000/folks/as.df