瀏覽代碼

upload support text/plain; charset=utf8 (#7899)

tags/v1.9.2
Lunny Xiao 4 年之前
父節點
當前提交
7dd726faeb
共有 3 個檔案被更改,包括 6 行新增3 行删除
  1. 2
    1
      routers/api/v1/repo/release_attachment.go
  2. 2
    1
      routers/repo/attachment.go
  3. 2
    1
      routers/repo/editor.go

+ 2
- 1
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
}

+ 2
- 1
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
}

+ 2
- 1
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
}

Loading…
取消
儲存