Unverified Commit 14b34edc authored by Lincoln Nogueira's avatar Lincoln Nogueira Committed by GitHub

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
parent 411e807d
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))
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment