Feat: generate thumbnails for image file
This commit is contained in:
@@ -57,13 +57,18 @@ func (fs *FileSystem) ValidateExtension(ctx context.Context, fileName string) bo
|
||||
return true
|
||||
}
|
||||
|
||||
return IsInExtensionList(fs.User.Policy.OptionsSerialized.FileType, fileName)
|
||||
}
|
||||
|
||||
// IsInExtensionList 返回文件的扩展名是否在给定的列表范围内
|
||||
func IsInExtensionList(extList []string, fileName string) bool {
|
||||
ext := strings.ToLower(filepath.Ext(fileName))
|
||||
// 无扩展名时
|
||||
if len(ext) == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
if util.ContainsString(fs.User.Policy.OptionsSerialized.FileType, ext[1:]) {
|
||||
if util.ContainsString(extList, ext[1:]) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user