web admin: allow both allowed and denied extensions/patterns for a dir

this fix a regression introduced in the previous commit
This commit is contained in:
Nicola Murino
2020-11-16 19:21:50 +01:00
parent a6355e298e
commit e3eca424f1
7 changed files with 110 additions and 49 deletions

View File

@@ -53,6 +53,22 @@ func IsStringPrefixInSlice(obj string, list []string) bool {
return false
}
// RemoveDuplicates returns a new slice removing any duplicate element from the initial one
func RemoveDuplicates(obj []string) []string {
if len(obj) == 0 {
return obj
}
result := make([]string, 0, len(obj))
seen := make(map[string]bool)
for _, item := range obj {
if _, ok := seen[item]; !ok {
result = append(result, item)
}
seen[item] = true
}
return result
}
// GetTimeAsMsSinceEpoch returns unix timestamp as milliseconds from a time struct
func GetTimeAsMsSinceEpoch(t time.Time) int64 {
return t.UnixNano() / 1000000