Skip to content

Commit

Permalink
Merge pull request #76 from wangxiao/master
Browse files Browse the repository at this point in the history
[bugfix] 修正关闭 encodeHTML 时多媒体格式没有对 text 赋值。
  • Loading branch information
wangxiao committed Apr 17, 2015
2 parents f94a2ce + 9674622 commit 8d7cace
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 1 addition & 3 deletions demo/demo2/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ function main() {
// 创建实时通信实例
rt = AV.realtime({
appId: appId,
clientId: clientId,
// 是否 HTML 转义,防止 XSS
encodeHTML: true
clientId: clientId
});

// 监听连接成功事件
Expand Down
2 changes: 2 additions & 0 deletions src/AV.realtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,15 @@ void function(win) {
}

var obj = {
text: msg._lctext,
attr: msg._lcattrs
};

// 是否对消息中的 HTML 进行转义,对媒体格式仅对 text 转义
if (cache.options.encodeHTML) {
obj.text = tool.encodeHTML(msg._lctext);
}

if (msg._lcfile && msg._lcfile.url) {
obj.url = msg._lcfile.url;
}
Expand Down

0 comments on commit 8d7cace

Please sign in to comment.