Fix issue where the EventReferenceSHA256 is not set

This commit is contained in:
Till Faelligen 2022-05-09 09:55:41 +02:00
parent 3bc4b357c6
commit 8ae34c4e5f
2 changed files with 6 additions and 2 deletions

View file

@ -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

View file

@ -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))