fix kafka attachment message id binding

This commit is contained in:
richjohnrambo
2026-10-14 12:13:45 +08:00
parent 6930b23cce
commit 87ec8f9833
2 changed files with 17 additions and 3 deletions
+8 -1
View File
@@ -128,7 +128,14 @@ func executeKafkaFileAttachmentsBind(tenantID types.TenantID, payload kafkaFileL
return types.ErrMalformed
}
if types.GetTopicCat(payload.Topic) != types.TopicCatGrp {
return store.Files.LinkAttachments(tenantID, "", msgID, payload.AttachmentURLs)
// Kafka persistence writes the decoded UID as the SQL message primary key,
// while the lifecycle payload carries the externally encoded UID. The
// file-link adapter expects the raw SQL ID, so decode it before binding.
databaseMsgID := types.Uid(store.DecodeUid(msgID))
if databaseMsgID.IsZero() {
return types.ErrMalformed
}
return store.Files.LinkAttachments(tenantID, "", databaseMsgID, payload.AttachmentURLs)
}
uploader := types.ParseUserId(payload.UserID)
if uploader.IsZero() {