提交 0226bc27 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

fix #918

上级 1a212831
......@@ -689,8 +689,9 @@ export class Bridge extends EventEmitter {
* Throw if there's a blocked message
*/
public async testBlockedMessage(text: string): Promise<void> {
const textSnip = text.substr(0, 50).replace(/\n/, '')
log.silly('PuppetWebBridge', 'testBlockedMessage(%s)',
text.substr(0, 50).replace(/\n/, ''))
textSnip)
interface BlockedMessage {
error?: {
......@@ -701,7 +702,12 @@ export class Bridge extends EventEmitter {
return new Promise<void>((resolve, reject) => {
parseString(text, { explicitArray: false }, (err, obj: BlockedMessage) => {
if (err) {
if (err) { // HTML can not be parsed to JSON
return resolve()
}
if (!obj) {
// FIXME: when will this happen?
log.warn('PuppetWebBridge', 'testBlockedMessage() parseString(%s) return empty obj', textSnip)
return resolve()
}
if (!obj.error) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册