upload support text/plain; charset=utf8 (#7899)
This commit is contained in:
parent
14c979c1b2
commit
7dd726faeb
3 changed files with 6 additions and 3 deletions
|
@ -183,7 +183,8 @@ func CreateReleaseAttachment(ctx *context.APIContext) {
|
||||||
allowed := false
|
allowed := false
|
||||||
for _, t := range allowedTypes {
|
for _, t := range allowedTypes {
|
||||||
t := strings.Trim(t, " ")
|
t := strings.Trim(t, " ")
|
||||||
if t == "*/*" || t == fileType {
|
if t == "*/*" || t == fileType ||
|
||||||
|
strings.HasPrefix(fileType, t+";") {
|
||||||
allowed = true
|
allowed = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,8 @@ func UploadAttachment(ctx *context.Context) {
|
||||||
allowed := false
|
allowed := false
|
||||||
for _, t := range allowedTypes {
|
for _, t := range allowedTypes {
|
||||||
t := strings.Trim(t, " ")
|
t := strings.Trim(t, " ")
|
||||||
if t == "*/*" || t == fileType {
|
if t == "*/*" || t == fileType ||
|
||||||
|
strings.HasPrefix(fileType, t+";") {
|
||||||
allowed = true
|
allowed = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,7 +628,8 @@ func UploadFileToServer(ctx *context.Context) {
|
||||||
allowed := false
|
allowed := false
|
||||||
for _, t := range setting.Repository.Upload.AllowedTypes {
|
for _, t := range setting.Repository.Upload.AllowedTypes {
|
||||||
t := strings.Trim(t, " ")
|
t := strings.Trim(t, " ")
|
||||||
if t == "*/*" || t == fileType {
|
if t == "*/*" || t == fileType ||
|
||||||
|
strings.HasPrefix(fileType, t+";") {
|
||||||
allowed = true
|
allowed = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue