forked from mtusi2026/mtusi2026lab4
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad36ab8a92 | ||
|
|
110236d01f | ||
|
|
b3d5d76302 | ||
|
|
ec0e6707b8 |
@@ -26,6 +26,9 @@ func (s *Store) CreateMessage(
|
||||
idempotencyKey string,
|
||||
idempotencyTTL time.Duration,
|
||||
) (model.Message, bool, error) {
|
||||
if attachmentIDs == nil {
|
||||
attachmentIDs = []string{}
|
||||
}
|
||||
var (
|
||||
tx pgx.Tx
|
||||
err error
|
||||
@@ -301,7 +304,8 @@ func insertMessage(
|
||||
if err := insertMessageAttachments(ctx, tx, messageID, chatID, attachmentIDs); err != nil {
|
||||
return model.Message{}, err
|
||||
}
|
||||
message.AttachmentIDs = append([]string(nil), attachmentIDs...)
|
||||
message.AttachmentIDs = make([]string, len(attachmentIDs))
|
||||
copy(message.AttachmentIDs, attachmentIDs)
|
||||
return message, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user