mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-03-27 09:46:36 +00:00
fix: Fixes and performance improvements in utils package (#331)
This commit is contained in:
committed by
GitHub
parent
b483e2e92f
commit
348192b9d7
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user