Skip to content

Commit 7dd726f

Browse files
lunnyzeripath
authored andcommitted
upload support text/plain; charset=utf8 (#7899)
1 parent 14c979c commit 7dd726f

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

routers/api/v1/repo/release_attachment.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ func CreateReleaseAttachment(ctx *context.APIContext) {
183183
allowed := false
184184
for _, t := range allowedTypes {
185185
t := strings.Trim(t, " ")
186-
if t == "*/*" || t == fileType {
186+
if t == "*/*" || t == fileType ||
187+
strings.HasPrefix(fileType, t+";") {
187188
allowed = true
188189
break
189190
}

routers/repo/attachment.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ func UploadAttachment(ctx *context.Context) {
4848
allowed := false
4949
for _, t := range allowedTypes {
5050
t := strings.Trim(t, " ")
51-
if t == "*/*" || t == fileType {
51+
if t == "*/*" || t == fileType ||
52+
strings.HasPrefix(fileType, t+";") {
5253
allowed = true
5354
break
5455
}

routers/repo/editor.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,8 @@ func UploadFileToServer(ctx *context.Context) {
628628
allowed := false
629629
for _, t := range setting.Repository.Upload.AllowedTypes {
630630
t := strings.Trim(t, " ")
631-
if t == "*/*" || t == fileType {
631+
if t == "*/*" || t == fileType ||
632+
strings.HasPrefix(fileType, t+";") {
632633
allowed = true
633634
break
634635
}

0 commit comments

Comments
 (0)