Permalink
Browse files

added html escaping

  • Loading branch information...
1 parent 4b18d73 commit 99bd1739ef68304e62c470684b9fb6fe134c440c @jimfleming jimfleming committed Sep 5, 2011
Showing with 7 additions and 255 deletions.
  1. +5 −5 public/scripts/main.js
  2. +2 −0 server.coffee
  3. +0 −250 server.js
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -206,13 +206,15 @@ socket.on 'connection', (client) ->
rows = []
_.each reply, (val, key) ->
try
+ val = val.replace(/</g, '&lt;').replace(/>/g, '&gt;')
val = JSON.stringify(JSON.parse(val), null, 2)
rows.push({ index: key, val: val })
return
reply = rows
else
if reply?
try # attempt to parse bulk values containing JSON
+ reply = reply.replace(/</g, '&lt;').replace(/>/g, '&gt;')
reply = JSON.stringify(JSON.parse(reply), null, 2)
else
reply = '(nil)'
View
250 server.js

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 99bd173

Please sign in to comment.