diff --git a/routers/models.go b/routers/models.go index ee7f677..949b7c9 100644 --- a/routers/models.go +++ b/routers/models.go @@ -314,8 +314,9 @@ func ModelItemPatch(w http.ResponseWriter, r *http.Request) { return } - // 判断数据类型是否JSON - if r.Header.Get("Content-Type") == "application/json" { + // 判断数据类型是否JSON(正则匹配) + //if r.Header.Get("Content-Type") == "application/json" { + if regexp.MustCompile(`application/json`).MatchString(r.Header.Get("Content-Type")) { // 取出更新数据 var model_new models.Model @@ -369,7 +370,7 @@ func ModelItemPatch(w http.ResponseWriter, r *http.Request) { if model_new.Progress != 0 && model_new.Progress != model.Progress { model.Progress = model_new.Progress } - if model_new.Tags != nil && len(model_new.Tags) != len(model.Tags) { + if model_new.Tags != nil { model.Tags = model_new.Tags }