Переглянути джерело

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,