From 39b11dbfb6f18c85ebe157ea9f85c7378c2cfb59 Mon Sep 17 00:00:00 2001 From: kim Date: Thu, 26 Jun 2025 14:17:47 +0200 Subject: [bugfix] fix issues with postgres array serialization (#4295) thank you to @kipvandenbos -erino for figuring this out! Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4295 Co-authored-by: kim Co-committed-by: kim --- internal/db/bundb/media.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'internal/db/bundb/media.go') diff --git a/internal/db/bundb/media.go b/internal/db/bundb/media.go index 845844980..86f63ace2 100644 --- a/internal/db/bundb/media.go +++ b/internal/db/bundb/media.go @@ -196,13 +196,17 @@ func (m *mediaDB) DeleteAttachment(ctx context.Context, id string) error { }) if len(updatedIDs) != len(status.AttachmentIDs) { + + // Convert to bun array for serialization. + arrIDs := bunArrayType(tx, updatedIDs) + // Note: this handles not found. // // Attachments changed, update the status. if _, err := tx.NewUpdate(). Table("statuses"). Where("? = ?", bun.Ident("id"), status.ID). - Set("? = ?", bun.Ident("attachment_ids"), updatedIDs). + Set("? = ?", bun.Ident("attachment_ids"), arrIDs). Exec(ctx); err != nil { return gtserror.Newf("error updating status: %w", err) } -- cgit v1.2.3