jschat 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/jschat/http/jschat.rb +7 -1
  2. metadata +3 -3
@@ -165,6 +165,12 @@ helpers do
165
165
  include Rack::Utils
166
166
  alias_method :h, :escape_html
167
167
 
168
+ def escape_json(string)
169
+ string.to_s.gsub("&", "&").
170
+ gsub("<", "&lt;").
171
+ gsub(">", "&gt;")
172
+ end
173
+
168
174
  def detected_layout
169
175
  iphone_user_agent? ? :iphone : :layout
170
176
  end
@@ -197,7 +203,7 @@ helpers do
197
203
 
198
204
  def messages_js(messages)
199
205
  messages ||= []
200
- messages.to_json
206
+ escape_json messages.to_json
201
207
  end
202
208
 
203
209
  def remove_my_messages(messages)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 8
9
- version: 0.2.8
8
+ - 9
9
+ version: 0.2.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alex R. Young
@@ -197,7 +197,7 @@ files:
197
197
  - test/test_helper.rb
198
198
  - README.textile
199
199
  - MIT-LICENSE
200
- has_rdoc: true
200
+ has_rdoc: false
201
201
  homepage: http://github.com/alexyoung/jschat
202
202
  licenses: []
203
203