blob: 8999f07e61484609eab2b648107f23643c545284 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
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" ||
mimetype == "video/mp2t" {
return false
}
return strings.HasPrefix(mimetype, "video") ||
strings.HasPrefix(mimetype, "image")
}
|