mirror of
https://github.com/usememos/memos.git
synced 2024-12-26 23:22:47 +08:00
chore: fix misuse of package path instead of filepath.path (#2684)
As stated by https://pkg.go.dev/path, "path" is mainly for URLs, "path.filepath" for file systems
This commit is contained in:
parent
411e807dcc
commit
14b34edca3
2 changed files with 4 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
package telegram
|
package telegram
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path"
|
"path/filepath"
|
||||||
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ func (b Attachment) GetMimeType() string {
|
||||||
return b.MimeType
|
return b.MimeType
|
||||||
}
|
}
|
||||||
|
|
||||||
mime, ok := mimeTypes[path.Ext(b.FileName)]
|
mime, ok := mimeTypes[filepath.Ext(b.FileName)]
|
||||||
if !ok {
|
if !ok {
|
||||||
// Handle unknown file extension
|
// Handle unknown file extension
|
||||||
log.Warn("Unknown file type for ", zap.String("filename", b.FileName))
|
log.Warn("Unknown file type for ", zap.String("filename", b.FileName))
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"unicode/utf16"
|
"unicode/utf16"
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ func (t *TelegramHandler) MessageHandle(ctx context.Context, bot *telegram.Bot,
|
||||||
// Fill the common field of create
|
// Fill the common field of create
|
||||||
create := store.Resource{
|
create := store.Resource{
|
||||||
CreatorID: creatorID,
|
CreatorID: creatorID,
|
||||||
Filename: path.Base(attachment.FileName),
|
Filename: filepath.Base(attachment.FileName),
|
||||||
Type: attachment.GetMimeType(),
|
Type: attachment.GetMimeType(),
|
||||||
Size: attachment.FileSize,
|
Size: attachment.FileSize,
|
||||||
MemoID: &memoMessage.ID,
|
MemoID: &memoMessage.ID,
|
||||||
|
|
Loading…
Reference in a new issue