tstor/daemons/kemono/utils.go
royalcat 585f317478
Some checks failed
docker / build-docker (push) Failing after 34s
daemons separation
2024-11-24 20:32:26 +03:00

25 lines
511 B
Go

package kemono
import (
"path/filepath"
"strings"
)
func isImage(ext string) bool {
switch ext {
case ".apng", ".avif", ".bmp", ".gif", ".ico", ".cur", ".jpg", ".jpeg", ".jfif", ".pjpeg", ".pjp", ".png", ".svg", ".tif", ".tiff", ".webp", ".jpe":
return true
default:
return false
}
}
func SplitHash(str string) (string, error) {
parts := strings.Split(str, "/")
if len(parts) < 4 {
return "", nil
}
ext := filepath.Ext(parts[3])
name := parts[3][:len(parts[3])-len(ext)]
return name, nil
}