From 851a8b8b21440ba92048a69e28c49a2fbb9743e7 Mon Sep 17 00:00:00 2001 From: jevb Date: Thu, 19 Mar 2026 04:27:11 +0100 Subject: [PATCH] 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. --- Server/db/attachment_queries.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Server/db/attachment_queries.go b/Server/db/attachment_queries.go index e178eab7..5e846852 100644 --- a/Server/db/attachment_queries.go +++ b/Server/db/attachment_queries.go @@ -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 }