Skip to content

Commit

Permalink
upload support text/plain; charset=utf8 (#7899)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored and zeripath committed Aug 17, 2019
1 parent 14c979c commit 7dd726f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion routers/api/v1/repo/release_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion routers/repo/attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion routers/repo/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 7dd726f

Please sign in to comment.