Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing bug with parsing context requests

  • Loading branch information...
commit 1ed48129871990cbea1e40f480c184c78f448add 1 parent 939e788
Mike Mattozzi authored
Showing with 13 additions and 7 deletions.
  1. +13 −7 webrepl.js
View
20 webrepl.js
@@ -89,13 +89,19 @@ ReplHttpServer.prototype.route = function(req, res) {
}
});
}
- } else if ((match = req.url.match(/^\/context\/(.*)/))) {
- var obj = eval('this.replServer.context.' + match[1]);
- if (obj) {
- res.writeHead(200, {'Content-Type': 'application/json'});
- res.end(JSON.stringify(obj));
- } else {
- res.writeHeader(404);
+ } else if ((match = req.url.match(/^\/context\/([a-zA-Z_$][0-9a-zA-Z_$\.]*)$/))) {
+ try {
+ var obj = eval('this.replServer.context.' + match[1]);
+ if (obj) {
+ res.writeHead(200, {'Content-Type': 'application/json'});
+ res.end(JSON.stringify(obj));
+ } else {
+ res.writeHeader(404);
+ res.end();
+ }
+ } catch (err) {
+ console.log("Error resolving context request: " + err.toString());
+ res.writeHeader(500);
res.end();
}
} else if ((match = req.url.match(/^\/complete\/(.*)/))) {
Please sign in to comment.
Something went wrong with that request. Please try again.