mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-25 06:16:58 +00:00
modernize ForbiddenMimeTypes
This commit is contained in:
parent
6234889495
commit
d35e41fa9f
3 changed files with 10 additions and 9 deletions
|
@ -48,9 +48,12 @@ func GetBranchTimestamp(giteaClient *gitea.Client, owner, repo, branch string, b
|
|||
}
|
||||
|
||||
func (o *Options) getMimeTypeByExtension() string {
|
||||
if o.ForbiddenMimeTypes == nil {
|
||||
o.ForbiddenMimeTypes = make(map[string]bool)
|
||||
}
|
||||
mimeType := mime.TypeByExtension(path.Ext(o.TargetPath))
|
||||
mimeTypeSplit := strings.SplitN(mimeType, ";", 2)
|
||||
if _, ok := o.ForbiddenMimeTypes[mimeTypeSplit[0]]; ok || mimeType == "" {
|
||||
if forbidden := o.ForbiddenMimeTypes[mimeTypeSplit[0]]; forbidden || mimeType == "" {
|
||||
if o.DefaultMimeType != "" {
|
||||
mimeType = o.DefaultMimeType
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue