Permalink
Browse files

Attempt to avoid decodeURI issue

  • Loading branch information...
1 parent 0f20852 commit c3956d1e0a3118f26a90c7e3a5bf624fd51c6428 @guybedford guybedford committed Jan 30, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/node-static.js
View
@@ -171,7 +171,13 @@ exports.Server.prototype.serve = function (req, res, callback) {
var that = this,
promise = new(events.EventEmitter);
- var pathname = decodeURI(url.parse(req.url).pathname);
+ var pathname;
+ try {
+ pathname = decodeURI(url.parse(req.url).pathname);
+ }
+ catch(e) {
+ promise.emit('error', e);
+ }
var finish = function (status, headers) {
that.finish(status, headers, req, res, promise, callback);

0 comments on commit c3956d1

Please sign in to comment.