feat(chat): add endpoint to get quoted message by ID
All checks were successful
Build Backend / build (push) Successful in 2m21s
Build Backend / build-docker (push) Successful in 58s

Add GET /api/v1/messages/:id endpoint to retrieve quoted/replied messages
for preview fill and navigation purposes. The endpoint includes authorization
checks ensuring only conversation participants can access the message.

Additionally improve file upload handling for native clients (expo-file-system)
by accepting explicit displayName from frontend, with sanitization to prevent
path traversal and 255-character length limit. File extension detection now
prioritizes the real display name over the multipart header filename.
This commit is contained in:
lafay
2026-07-02 23:22:24 +08:00
parent d8e56e60dc
commit d240485d0e
5 changed files with 109 additions and 7 deletions

View File

@@ -407,6 +407,8 @@ func (r *Router) setupRoutes() {
messages := v1.Group("/messages")
messages.Use(authMiddleware)
{
// 按 ID 获取被引用消息(引用预览回填/跳转)
messages.GET("/:id", r.MessageHandler.GetReplyMessage)
// 撤回/删除消息(统一接口)
messages.POST("/delete_msg", middleware.RequireVerified(r.UserService), r.MessageHandler.HandleDeleteMsg)
}