From b14334220f2f529df5c2feebd475c102bc03f820 Mon Sep 17 00:00:00 2001 From: Athurg Gooth Date: Thu, 21 Dec 2023 09:47:57 +0800 Subject: [PATCH] fix: trim the dirname of attachment send by telegram bot (#2651) --- server/integration/telegram.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/integration/telegram.go b/server/integration/telegram.go index 142df964..fe423865 100644 --- a/server/integration/telegram.go +++ b/server/integration/telegram.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "fmt" + "path" "strconv" "unicode/utf16" @@ -84,7 +85,7 @@ func (t *TelegramHandler) MessageHandle(ctx context.Context, bot *telegram.Bot, // Fill the common field of create create := store.Resource{ CreatorID: creatorID, - Filename: attachment.FileName, + Filename: path.Base(attachment.FileName), Type: attachment.GetMimeType(), Size: attachment.FileSize, MemoID: &memoMessage.ID,