dukechronicle / chronjs

Source code for a former version of dukechronicle.com
dukechronicle.com
8 stars 1 forks source link

Parse URI-illegal characters before search #280

Closed ethanngoh closed 12 years ago

ethanngoh commented 12 years ago

Searching "%" or anything like "95% noob" crashes search.

error: { stack: [Getter/Setter], arguments: undefined, type: undefined, message: 'URI malformed' } URIError: URI malformed at decodeURIComponent (native) at /Users/yhgoh88/Documents/Chronline/website/node_modules/connect/lib/middleware/static.js:119:14 at Object.static as handle at next (/Users/yhgoh88/Documents/Chronline/website/node_modules/connect/lib/http.js:203:15) at Object.handle (/Users/yhgoh88/Documents/Chronline/website/node_modules/express/lib/http.js:84:5) at next (/Users/yhgoh88/Documents/Chronline/website/node_modules/connect/lib/http.js:203:15) at HTTPServer.handle (/Users/yhgoh88/Documents/Chronline/website/node_modules/connect/lib/http.js:216:3) at HTTPServer.emit (events.js:67:17) at HTTPParser.onIncoming (http.js:1134:12) at HTTPParser.onHeadersComplete (http.js:108:31)

The search string should be replaced with the appropriate escape/special codes before being passed as URI.