|
|
@@ -2,11 +2,9 @@ package repo |
|
|
|
|
|
|
|
import ( |
|
|
|
"bufio" |
|
|
|
"code.gitea.io/gitea/modules/timeutil" |
|
|
|
"encoding/json" |
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"github.com/unknwon/i18n" |
|
|
|
"io" |
|
|
|
"net/http" |
|
|
|
"os" |
|
|
@@ -15,6 +13,10 @@ import ( |
|
|
|
"strconv" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
"unicode/utf8" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/timeutil" |
|
|
|
"github.com/unknwon/i18n" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/models" |
|
|
|
"code.gitea.io/gitea/modules/auth" |
|
|
@@ -470,12 +472,17 @@ func CloudBrainImageEdit(ctx *context.Context) { |
|
|
|
ctx.NotFound(ctx.Req.URL.RequestURI(), nil) |
|
|
|
} |
|
|
|
ctx.Data["Image"] = image |
|
|
|
ctx.HTML(http.StatusOK, tplCloudBrainImageSubmit) |
|
|
|
ctx.HTML(http.StatusOK, tplCloudBrainImageEdit) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func CloudBrainImageEditPost(ctx *context.Context, form auth.EditImageCloudBrainForm) { |
|
|
|
|
|
|
|
if utf8.RuneCountInString(form.Description) > 255 { |
|
|
|
ctx.JSON(http.StatusOK, models.BaseErrorMessage(ctx.Tr("dataset.description_format_err", 255))) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
validTopics, errMessage := checkTopics(form.Topics) |
|
|
|
if errMessage != "" { |
|
|
|
ctx.JSON(http.StatusOK, models.BaseErrorMessage(ctx.Tr(errMessage))) |
|
|
@@ -529,6 +536,16 @@ func CloudBrainImageDelete(ctx *context.Context) { |
|
|
|
|
|
|
|
func CloudBrainCommitImage(ctx *context.Context, form auth.CommitImageCloudBrainForm) { |
|
|
|
|
|
|
|
if !NamePattern.MatchString(form.Tag) { |
|
|
|
ctx.JSON(http.StatusOK, models.BaseErrorMessage(ctx.Tr("dataset.title_format_err"))) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if utf8.RuneCountInString(form.Description) > 255 { |
|
|
|
ctx.JSON(http.StatusOK, models.BaseErrorMessage(ctx.Tr("dataset.description_format_err", 255))) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
validTopics, errMessage := checkTopics(form.Topics) |
|
|
|
if errMessage != "" { |
|
|
|
ctx.JSON(http.StatusOK, ctx.Tr(errMessage)) |
|
|
|