fix: add rows.Err() check in GetAttachmentsByMessageIDs

Prevents silently returning truncated attachment maps when the DB
cursor errors mid-iteration. Matches the pattern used in all other
query loops across the codebase.
This commit is contained in:
jevb
2026-03-19 04:27:11 +01:00
parent a7df9c2b3c
commit 851a8b8b21
+3
View File
@@ -110,5 +110,8 @@ func (d *DB) GetAttachmentsByMessageIDs(msgIDs []int64) (map[int64][]AttachmentI
ai.URL = "/api/v1/files/" + id
result[msgID] = append(result[msgID], ai)
}
if rows.Err() != nil {
return nil, fmt.Errorf("GetAttachmentsByMessageIDs rows: %w", rows.Err())
}
return result, nil
}