Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: fix misuse of package path instead of filepath.path (#2684)

Lincoln Nogueira14b34edca36e
diff --git a/plugin/telegram/attachment.go b/plugin/telegram/attachment.go
index e252f3f06..b7ed7cb15 100644
--- a/plugin/telegram/attachment.go
+++ b/plugin/telegram/attachment.go
@@ -1,7 +1,7 @@
package telegram
import (
- "path"
+ "path/filepath"
"go.uber.org/zap"
@@ -27,7 +27,7 @@ func (b Attachment) GetMimeType() string {
return b.MimeType
}
- mime, ok := mimeTypes[path.Ext(b.FileName)]
+ mime, ok := mimeTypes[filepath.Ext(b.FileName)]
if !ok {
// Handle unknown file extension
log.Warn("Unknown file type for ", zap.String("filename", b.FileName))
diff --git a/server/integration/telegram.go b/server/integration/telegram.go
index fe423865f..b7ee93908 100644
--- a/server/integration/telegram.go
+++ b/server/integration/telegram.go
@@ -4,7 +4,7 @@ import (
"bytes"
"context"
"fmt"
- "path"
+ "path/filepath"
"strconv"
"unicode/utf16"
@@ -85,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: path.Base(attachment.FileName),
+ Filename: filepath.Base(attachment.FileName),
Type: attachment.GetMimeType(),
Size: attachment.FileSize,
MemoID: &memoMessage.ID,