#4353 界面上传文件流控先不加。

Merged
ychao_1983 merged 1 commits from zouap_static into V20230531 10 months ago
  1. +1
    -1
      routers/api/v1/repo/attachments.go
  2. +8
    -7
      routers/repo/attachment.go

+ 1
- 1
routers/api/v1/repo/attachments.go View File

@@ -67,7 +67,7 @@ func NewMultipart(ctx *context.APIContext) {
defer mutex.Unlock()
datasetId := ctx.QueryInt64("dataset_id")
fileName := ctx.Query("file_name")
re, err := routeRepo.NewMultipartForApi(ctx.Context)
re, err := routeRepo.NewMultipartForApi(ctx.Context, true)
if err != nil {
ctx.JSON(200, map[string]string{
"result_code": "-1",


+ 8
- 7
routers/repo/attachment.go View File

@@ -667,7 +667,7 @@ func GetSuccessChunks(ctx *context.Context) {

}

func NewMultipartForApi(ctx *context.Context) (map[string]string, error) {
func NewMultipartForApi(ctx *context.Context, isFlowControl bool) (map[string]string, error) {
if !setting.Attachment.Enabled {
return nil, errors.New("attachment is not enabled")
}
@@ -680,11 +680,12 @@ func NewMultipartForApi(ctx *context.Context) (map[string]string, error) {
return nil, errors.New("Cannot upload repeatedly,name is " + ctx.Query("file_name"))
}
}

err = CheckFlowForDataset(ctx)
if err != nil {
log.Info("check error," + err.Error())
return nil, err
if isFlowControl {
err = CheckFlowForDataset(ctx)
if err != nil {
log.Info("check error," + err.Error())
return nil, err
}
}
err = upload.VerifyFileType(ctx.Query("fileType"), strings.Split(setting.Attachment.AllowedTypes, ","))
if err != nil {
@@ -754,7 +755,7 @@ func NewMultipartForApi(ctx *context.Context) (map[string]string, error) {
}

func NewMultipart(ctx *context.Context) {
re, err := NewMultipartForApi(ctx)
re, err := NewMultipartForApi(ctx, false)
if err != nil {
ctx.ServerError("NewMultipart failed", err)
return


Loading…
Cancel
Save