#4168 fix-4127

Merged
zouap merged 2 commits from fix-4127 into V20230517 1 year ago
  1. +3
    -2
      options/locale/locale_en-US.ini
  2. +2
    -1
      options/locale/locale_zh-CN.ini
  3. +1
    -1
      routers/repo/cloudbrain.go
  4. +2
    -2
      routers/repo/grampus.go
  5. +2
    -0
      routers/repo/util.go

+ 3
- 2
options/locale/locale_en-US.ini View File

@@ -1117,8 +1117,9 @@ images.name = Image Tag
images.name_placerholder = Please enter the image name
image.label_tooltips = Example Python 3.7, Tensorflow 2.0, cuda 10, pytorch 1.6
images.public_tooltips = After the image is set to public, it can be seen by other users.
images.name_rule50 = Please enter letters, numbers, _ and - up to 50 characters and cannot end with a dash (-).
images.name_rule100 = Please enter letters, numbers, _ and - up to 100 characters and cannot end with a dash (-).
images.name_format_err=The format of image tag is wrong.
images.name_rule50 = Please enter letters, numbers, _ and - up to 50 characters and starts with a letter.
images.name_rule100 = Please enter letters, numbers, _ and - up to 100 characters and cannot end with a dash (-).
images.delete_task = Delete image
images.task_delete_confirm = Are you sure you want to delete this image? Once this image is deleted, it cannot be recovered.
export_result_to_dataset = Export the results to a dataset


+ 2
- 1
options/locale/locale_zh-CN.ini View File

@@ -1116,7 +1116,8 @@ images.name = 镜像Tag
images.name_placerholder = 请输入镜像Tag
image.label_tooltips = 如Python 3.7, Tensorflow 2.0, cuda 10, pytorch 1.6
images.public_tooltips = 镜像设置为公开后,可被其他用户看到。
images.name_rule50 = 请输入字母、数字、_和-,最长50个字符,且不能以中划线(-)结尾。
images.name_format_err=镜像Tag格式错误。
images.name_rule50 = 请输入字母、数字、_和-,最长50个字符,且以字母开头。
images.name_rule100 = 请输入字母、数字、_和-,最长100个字符,且不能以中划线(-)结尾。
images.delete_task = 删除镜像
images.task_delete_confirm = 你确认删除该镜像么?此镜像一旦删除不可恢复。


+ 1
- 1
routers/repo/cloudbrain.go View File

@@ -1222,7 +1222,7 @@ func CloudBrainAdminCommitImage(ctx *context.Context, form auth.CommitAdminImage
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")))
ctx.JSON(http.StatusOK, models.BaseErrorMessage(ctx.Tr("repo.images.name_format_err")))
return
}



+ 2
- 2
routers/repo/grampus.go View File

@@ -2014,8 +2014,8 @@ func GrampusCommitImageShow(ctx *context.Context) {

func GrampusCommitImage(ctx *context.Context, form auth.CommitImageGrampusForm) {

if !NamePattern.MatchString(form.Tag) {
ctx.JSON(http.StatusOK, models.BaseErrorMessage(ctx.Tr("dataset.title_format_err")))
if !GrampusNamePattern.MatchString(form.Tag) {
ctx.JSON(http.StatusOK, models.BaseErrorMessage(ctx.Tr("repo.images.name_format_err")))
return
}



+ 2
- 0
routers/repo/util.go View File

@@ -3,3 +3,5 @@ package repo
import "regexp"

var NamePattern = regexp.MustCompile(`^[A-Za-z0-9-_\\.]{1,100}$`)

var GrampusNamePattern = regexp.MustCompile(`^[A-Za-z][\\w|\\-|\\.]{0,49}$`)

Loading…
Cancel
Save