From c52a32952fda3de8b3a3223dc4ef709678a644e0 Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Thu, 19 May 2022 14:23:27 +0800 Subject: [PATCH] #2133 fix bug --- options/locale/locale_en-US.ini | 1 + options/locale/locale_zh-CN.ini | 1 + routers/repo/editor.go | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 4a5c6afd78..ef3ad77058 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1311,6 +1311,7 @@ editor.directory_is_a_file = Directory name '%s' is already used as a filename i editor.file_is_a_symlink = '%s' is a symbolic link. Symbolic links cannot be edited in the web editor editor.filename_is_a_directory = Filename '%s' is already used as a directory name in this repository. editor.file_editing_no_longer_exists = The file being edited, '%s', no longer exists in this repository. +editor.file_or_directory_editing_no_longer_exists = The file or directory being edited, '%s', no longer exists in this repository. editor.file_deleting_no_longer_exists = The file being deleted, '%s', no longer exists in this repository. editor.file_changed_while_editing = The file contents have changed since you started editing. Click here to see them or Commit Changes again to overwrite them. editor.file_already_exists = A file named '%s' already exists in this repository. diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 7d70b945f9..2f0bbe91d9 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -1323,6 +1323,7 @@ editor.directory_is_a_file='%s' 已经作为文件名在此项目中存在。 editor.file_is_a_symlink='%s' 是一个符号链接,无法在线编辑。 editor.filename_is_a_directory='%s' 已经作为目录名在此项目中存在。 editor.file_editing_no_longer_exists=正在编辑的文件 '%s' 已不存在。 +editor.file_or_directory_editing_no_longer_exists=正在编辑的文件或文件夹 '%s' 已不存在。 editor.file_deleting_no_longer_exists=项目中不存在将被删除的文件‘%s’。 editor.file_changed_while_editing=文件内容在您进行编辑时已经发生变动。单击此处 查看变动的具体内容,或者 再次提交 覆盖已发生的变动。 editor.file_already_exists=此项目已经存在名为 '%s' 的文件。 diff --git a/routers/repo/editor.go b/routers/repo/editor.go index b389759f51..40edc47672 100644 --- a/routers/repo/editor.go +++ b/routers/repo/editor.go @@ -839,9 +839,9 @@ func renameFilePost(ctx *context.Context, form auth.RenameRepoFileForm) { }); err != nil { // This is where we handle all the errors thrown by repofiles.CreateOrUpdateRepoFile if git.IsErrNotExist(err) { - ctx.JSON(http.StatusOK, response.ServerError(ctx.Tr("repo.editor.file_editing_no_longer_exists", ctx.Repo.TreePath))) + ctx.JSON(http.StatusOK, response.ServerError(ctx.Tr("repo.editor.file_or_directory_editing_no_longer_exists", ctx.Repo.TreePath))) } else if models.IsErrLFSFileLocked(err) { - ctx.JSON(http.StatusOK, response.ServerError(ctx.Tr("repo.editor.file_editing_no_longer_exists", ctx.Tr("repo.editor.upload_file_is_locked", err.(models.ErrLFSFileLocked).Path, err.(models.ErrLFSFileLocked).UserName)))) + ctx.JSON(http.StatusOK, response.ServerError(ctx.Tr("repo.editor.file_or_directory_editing_no_longer_exists", ctx.Tr("repo.editor.upload_file_is_locked", err.(models.ErrLFSFileLocked).Path, err.(models.ErrLFSFileLocked).UserName)))) } else if models.IsErrFilenameInvalid(err) { ctx.JSON(http.StatusOK, response.ServerError(ctx.Tr("repo.editor.filename_is_invalid", form.TreePath))) } else if models.IsErrFilePathInvalid(err) { -- 2.34.1