diff --git a/modules/repofiles/update.go b/modules/repofiles/update.go index d7751d50e..07440301a 100644 --- a/modules/repofiles/update.go +++ b/modules/repofiles/update.go @@ -783,6 +783,7 @@ func RenameRepoFile(repo *models.Repository, doer *models.User, opts *RenameRepo // Check that the path given in opts.treePath is valid (not a git path) treePath := CleanUploadFileName(opts.TreePath) + treePath = strings.ReplaceAll(treePath, " ", "") if treePath == "" { return models.ErrFilenameInvalid{ Path: opts.TreePath, @@ -942,16 +943,16 @@ func moveAndAddFiles(oldTreePath, newTreePath string, t *TemporaryUploadReposito } //example for v(mode SHA-1 stage file) //100755 d294c88235ac05d3dece028d8a65590f28ec46ac 0 custom/conf/app.ini - v = strings.ReplaceAll(v, "0\t", "") - tmpArray := strings.Split(v, " ") - oldPath := tmpArray[2] + tempArray := strings.Split(v, "0\t") + leftArray := strings.Split(tempArray[0], " ") + oldPath := tempArray[1] newPath := newTreePath + strings.TrimPrefix(oldPath, oldTreePath) // mode 0 means remove file stdIn.WriteString("0 0000000000000000000000000000000000000000\t") stdIn.WriteString(oldPath) stdIn.WriteByte('\000') - stdIn.WriteString(tmpArray[0] + " ") - stdIn.WriteString(tmpArray[1] + "\t") + stdIn.WriteString(leftArray[0] + " ") + stdIn.WriteString(leftArray[1] + "\t") stdIn.WriteString(newPath) stdIn.WriteByte('\000') } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 265e7ed36..7288f2ce8 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2946,6 +2946,7 @@ raw_minutes = minutes [dropzone] default_message = Drop files or click here to upload. +default_dataset_message = Click to add files or directly drag and drop files here invalid_input_type = You can not upload files of this type. file_too_big = File size ({{filesize}} MB) exceeds the maximum size of ({{maxFilesize}} MB). remove_file = Remove file diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 1b26a930c..9a89d194a 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2956,6 +2956,7 @@ raw_minutes=分钟 [dropzone] default_message=拖动文件或者点击此处上传。 +default_dataset_message=点击添加文件或直接拖拽文件到此处。 invalid_input_type=您不能上传该类型的文件 file_too_big=文件体积({{filesize}} MB)超过了最大允许体积({{maxFilesize}} MB) remove_file=移除文件 diff --git a/routers/repo/dataset.go b/routers/repo/dataset.go index 73036a2cc..0e57fe1a0 100755 --- a/routers/repo/dataset.go +++ b/routers/repo/dataset.go @@ -106,6 +106,8 @@ func DatasetIndex(ctx *context.Context) { MustEnableDataset(ctx) ctx.Data["PageIsDataset"] = true + ctx.Data["SortType"] = ctx.Query("sort") + repo := ctx.Repo.Repository dataset, err := models.GetDatasetByRepo(repo) @@ -128,9 +130,31 @@ func DatasetIndex(ctx *context.Context) { attachments := newFilterPrivateAttachments(ctx, dataset.Attachments, repo) - sort.Slice(attachments, func(i, j int) bool { - return attachments[i].CreatedUnix > attachments[j].CreatedUnix - }) + if ctx.Data["SortType"] == "nameAsc" { + sort.Slice(attachments, func(i, j int) bool { + return strings.ToLower(attachments[i].Name) < strings.ToLower(attachments[j].Name) + }) + } else if ctx.Data["SortType"] == "nameDesc" { + sort.Slice(attachments, func(i, j int) bool { + return strings.ToLower(attachments[i].Name) > strings.ToLower(attachments[j].Name) + }) + } else if ctx.Data["SortType"] == "sizeAsc" { + sort.Slice(attachments, func(i, j int) bool { + return attachments[i].Size < attachments[j].Size + }) + } else if ctx.Data["SortType"] == "sizeDesc" { + sort.Slice(attachments, func(i, j int) bool { + return attachments[i].Size > attachments[j].Size + }) + } else if ctx.Data["SortType"] == "timeAsc" { + sort.Slice(attachments, func(i, j int) bool { + return attachments[i].CreatedUnix < attachments[j].CreatedUnix + }) + } else { + sort.Slice(attachments, func(i, j int) bool { + return attachments[i].CreatedUnix > attachments[j].CreatedUnix + }) + } page := ctx.QueryInt("page") if page <= 0 { diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 6f0d2f373..aceabeb93 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -1454,8 +1454,8 @@ func obsMkdir(dir string) error { } func paramCheckCreateTrainJob(form auth.CreateModelArtsTrainJobForm) error { - if !strings.HasSuffix(form.BootFile, ".py") { - log.Error("the boot file(%s) must be a python file", form.BootFile) + if !strings.HasSuffix(strings.TrimSpace(form.BootFile), ".py") { + log.Error("the boot file(%s) must be a python file", strings.TrimSpace(form.BootFile)) return errors.New("启动文件必须是python文件") } @@ -1472,8 +1472,8 @@ func paramCheckCreateTrainJob(form auth.CreateModelArtsTrainJobForm) error { } func paramCheckCreateInferenceJob(form auth.CreateModelArtsInferenceJobForm) error { - if !strings.HasSuffix(form.BootFile, ".py") { - log.Error("the boot file(%s) must be a python file", form.BootFile) + if !strings.HasSuffix(strings.TrimSpace(form.BootFile), ".py") { + log.Error("the boot file(%s) must be a python file", strings.TrimSpace(form.BootFile)) return errors.New("启动文件必须是python文件") } diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl index 0f862da7a..b967ee684 100644 --- a/templates/org/member/members.tmpl +++ b/templates/org/member/members.tmpl @@ -9,14 +9,14 @@
{{ range .Members}}
-
+
{{.FullName}}
-
+
{{$.i18n.Tr "org.members.membership_visibility"}}
diff --git a/templates/org/navber.tmpl b/templates/org/navber.tmpl index 772d9f67e..c2c3d51c0 100755 --- a/templates/org/navber.tmpl +++ b/templates/org/navber.tmpl @@ -48,7 +48,7 @@
-