fix: ext issues
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"mime"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"exporter/pkg/errorx"
|
||||
@@ -197,9 +198,11 @@ func (t *TClient) savePhoto(ctx context.Context, cfg *DBChannel, photo *tg.Photo
|
||||
|
||||
func (t *TClient) getExtByFilenameAndMimeType(filename, mimeType string) string {
|
||||
ext := ""
|
||||
if filename != "" {
|
||||
ext = filename[strings.LastIndex(filename, "."):]
|
||||
return ext
|
||||
if filename != "" && strings.Contains(filename, ".") {
|
||||
ext = filepath.Ext(filename)
|
||||
if ext != "" {
|
||||
return ext
|
||||
}
|
||||
}
|
||||
|
||||
exts, err := mime.ExtensionsByType(mimeType)
|
||||
|
||||
Reference in New Issue
Block a user