mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-03 03:36:22 -07:00
Enable processing of files with extensions explicitly allowed by the admin
This commit is contained in:
parent
ef5a9f49c3
commit
530011be61
4 changed files with 21 additions and 9 deletions
|
@ -393,7 +393,16 @@ type UploadConfig struct {
|
|||
ExiftoolPath string
|
||||
}
|
||||
|
||||
func (uc *UploadConfig) AcceptexExtension(filename string) bool {
|
||||
func (uc *UploadConfig) AcceptedOtherExtension(ext string) bool {
|
||||
for _, allowedExt := range uc.AllowOtherExtensions {
|
||||
if ext == allowedExt {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (uc *UploadConfig) AcceptedExtension(filename string) bool {
|
||||
ext := strings.ToLower(path.Ext(filename))
|
||||
switch ext {
|
||||
// images
|
||||
|
@ -420,12 +429,7 @@ func (uc *UploadConfig) AcceptexExtension(filename string) bool {
|
|||
case ".zip":
|
||||
return uc.AllowUploadingZipFiles
|
||||
}
|
||||
for _, allowedExt := range uc.AllowOtherExtensions {
|
||||
if ext == allowedExt {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return uc.AcceptedOtherExtension(ext)
|
||||
}
|
||||
|
||||
type PostConfig struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue