fix: Fixes and performance improvements in utils package (#331)

This commit is contained in:
Alessandro (Ale) Segala
2025-03-14 17:21:24 -07:00
committed by GitHub
parent b483e2e92f
commit 348192b9d7
6 changed files with 260 additions and 28 deletions

View File

@@ -5,14 +5,16 @@ import (
"mime/multipart"
"os"
"path/filepath"
"strings"
"github.com/pocket-id/pocket-id/backend/resources"
)
func GetFileExtension(filename string) string {
splitted := strings.Split(filename, ".")
return splitted[len(splitted)-1]
ext := filepath.Ext(filename)
if len(ext) > 0 && ext[0] == '.' {
return ext[1:]
}
return filename
}
func GetImageMimeType(ext string) string {