From 8ae34c4e5f78584f0edb479f5a893556d2b95d19 Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Mon, 9 May 2022 09:55:41 +0200 Subject: [PATCH] Fix issue where the EventReferenceSHA256 is not set --- roomserver/storage/postgres/events_table.go | 4 +++- roomserver/storage/sqlite3/events_table.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/roomserver/storage/postgres/events_table.go b/roomserver/storage/postgres/events_table.go index 86d226ce7..cdea208b8 100644 --- a/roomserver/storage/postgres/events_table.go +++ b/roomserver/storage/postgres/events_table.go @@ -421,11 +421,13 @@ func (s *eventStatements) BulkSelectEventReference( defer internal.CloseAndLogIfError(ctx, rows, "bulkSelectEventReference: rows.close() failed") results := make([]gomatrixserverlib.EventReference, len(eventNIDs)) i := 0 + var eventSHA []byte for ; rows.Next(); i++ { result := &results[i] - if err = rows.Scan(&result.EventID, &result.EventSHA256); err != nil { + if err = rows.Scan(&result.EventID, &eventSHA); err != nil { return nil, err } + result.EventSHA256 = eventSHA } if err = rows.Err(); err != nil { return nil, err diff --git a/roomserver/storage/sqlite3/events_table.go b/roomserver/storage/sqlite3/events_table.go index feb06150a..f60119889 100644 --- a/roomserver/storage/sqlite3/events_table.go +++ b/roomserver/storage/sqlite3/events_table.go @@ -457,11 +457,13 @@ func (s *eventStatements) BulkSelectEventReference( defer internal.CloseAndLogIfError(ctx, rows, "bulkSelectEventReference: rows.close() failed") results := make([]gomatrixserverlib.EventReference, len(eventNIDs)) i := 0 + var eventSHA []byte for ; rows.Next(); i++ { result := &results[i] - if err = rows.Scan(&result.EventID, &result.EventSHA256); err != nil { + if err = rows.Scan(&result.EventID, &eventSHA); err != nil { return nil, err } + result.EventSHA256 = eventSHA } if i != len(eventNIDs) { return nil, fmt.Errorf("storage: event NIDs missing from the database (%d != %d)", i, len(eventNIDs))