diff --git a/routers/api/v1/repo/release_attachment.go b/routers/api/v1/repo/release_attachment.go index f85787bc5..aa2cc14cf 100644 --- a/routers/api/v1/repo/release_attachment.go +++ b/routers/api/v1/repo/release_attachment.go @@ -183,7 +183,8 @@ func CreateReleaseAttachment(ctx *context.APIContext) { allowed := false for _, t := range allowedTypes { t := strings.Trim(t, " ") - if t == "*/*" || t == fileType { + if t == "*/*" || t == fileType || + strings.HasPrefix(fileType, t+";") { allowed = true break } diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index 8913e6301..47fa8faaa 100644 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -48,7 +48,8 @@ func UploadAttachment(ctx *context.Context) { allowed := false for _, t := range allowedTypes { t := strings.Trim(t, " ") - if t == "*/*" || t == fileType { + if t == "*/*" || t == fileType || + strings.HasPrefix(fileType, t+";") { allowed = true break } diff --git a/routers/repo/editor.go b/routers/repo/editor.go index 0d71e6d2e..5b95b9391 100644 --- a/routers/repo/editor.go +++ b/routers/repo/editor.go @@ -628,7 +628,8 @@ func UploadFileToServer(ctx *context.Context) { allowed := false for _, t := range setting.Repository.Upload.AllowedTypes { t := strings.Trim(t, " ") - if t == "*/*" || t == fileType { + if t == "*/*" || t == fileType || + strings.HasPrefix(fileType, t+";") { allowed = true break }