YahooArchive / fluxible-router

MOVED TO FLUXIBLE REPO
104 stars 26 forks source link

SyntaxError: Expected "\\#", "\\u", "\\{", "\\}", "{", [^{}\\\0-\x1F \t\n\r], end of input or whitespace but "\\" found. #71

Closed geekyme closed 8 years ago

geekyme commented 9 years ago

When a user navigates to a route with query parameter ending with a backslash \, the above syntax error will be thrown.

eg. /search?query=test\ will throw the error.

This will happen both on the front end and backend on an isomorphic app where routes are shared. It appears that it is happening on the navigateAction call.

mridgway commented 9 years ago

@lingyan Could this be happening within routr?

lingyan commented 9 years ago

routr strips off query string and hash before trying to match a url to routes: https://github.com/yahoo/routr/blob/master/lib/router.js#L74-L94

@geekyme Does the stack trace show which lib/line throws the error?

geekyme commented 9 years ago

Unfortunately no, there was no stack trace. :(

On 28 Jul 2015, at 6:18 am, lingyan notifications@github.com wrote:

routr strips off query string and hash before trying to match a url to routes: https://github.com/yahoo/routr/blob/master/lib/router.js#L74-L94 https://github.com/yahoo/routr/blob/master/lib/router.js#L74-L94 @geekyme https://github.com/geekyme Does the stack trace show which lib/line throws the error?

— Reply to this email directly or view it on GitHub https://github.com/yahoo/fluxible-router/issues/71#issuecomment-125363630.

geekyme commented 9 years ago

Following up on this, got the same syntax error triggering when a user access the route with query parameter ?query=%5BD.Y.O.N%5DPopular+Taiwan+Teeth+Whitening+Spa%21%7B+

jithine commented 9 years ago

This error actually comes from https://github.com/yahoo/intl-messageformat when there is escaped '\'

I hit this error on a totally different use case (directly using IntlMessageFormat) and was trying to find a solution when I stumbled up on this issue. Might be related.