浏览代码

Backport fixing custom fields leaking in history sync

Tulir Asokan 3 年之前
父节点
当前提交
a58cae16cd
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      historysync.go

+ 7 - 0
historysync.go

@@ -478,6 +478,13 @@ func (portal *Portal) wrapBatchEvent(info *types.MessageInfo, intent *appservice
 	if err != nil {
 		return nil, err
 	}
+	if newEventType == event.EventEncrypted {
+		// Clear other custom keys if the event was encrypted, but keep the double puppet identifier
+		wrappedContent.Raw = map[string]interface{}{backfillIDField: info.ID}
+		if intent.IsCustomPuppet {
+			wrappedContent.Raw[doublePuppetKey] = doublePuppetValue
+		}
+	}
 	return &event.Event{
 		Sender:    intent.UserID,
 		Type:      newEventType,