aboutsummaryrefslogtreecommitdiff
path: root/pkg/fileop/file.go
blob: 10e220242ecdd4124c057cca253bacb095bcc7a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package fileop

import (
	"crypto/md5"
	"encoding/hex"
	"strings"
)

func GetHashFromPath(path string) string {
	hash := md5.Sum([]byte(path))
	return hex.EncodeToString(hash[:])
}

func IsMimeTypeSupported(mimetype string) bool {
	if mimetype == "image/svg+xml" {
		return false
	}
	return strings.HasPrefix(mimetype, "video") ||
		strings.HasPrefix(mimetype, "image")
}