aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorDavid Svantesson <davidsvantesson@gmail.com>2019-11-02 08:37:05 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2019-11-02 15:37:05 +0800
commit232340f5e3ebe61787021bebea01fd755513c72b (patch)
tree513182b15c4d977bc64dcabafddd536eab4a8bbc /routers/repo
parent9d663dfde68f4f3fd6af302aad47439adb1076ae (diff)
downloadgitea-232340f5e3ebe61787021bebea01fd755513c72b.tar.gz
gitea-232340f5e3ebe61787021bebea01fd755513c72b.zip
Prevent upload (overwrite) of lfs locked file (#8769)
* Check if file is locked on upload file commit. * Better user message if file is locked. * Check lfs lock before creating temporary repository. fix some errors. * move lines * Add comment that enabled setting is checked.
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/editor.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/repo/editor.go b/routers/repo/editor.go
index d4a7dab074..763429f8cf 100644
--- a/routers/repo/editor.go
+++ b/routers/repo/editor.go
@@ -585,7 +585,11 @@ func UploadFilePost(ctx *context.Context, form auth.UploadRepoFileForm) {
Files: form.Files,
}); err != nil {
ctx.Data["Err_TreePath"] = true
- ctx.RenderWithErr(ctx.Tr("repo.editor.unable_to_upload_files", form.TreePath, err), tplUploadFile, &form)
+ if models.IsErrLFSFileLocked(err) {
+ ctx.RenderWithErr(ctx.Tr("repo.editor.upload_file_is_locked", err.(models.ErrLFSFileLocked).Path, err.(models.ErrLFSFileLocked).UserName), tplUploadFile, &form)
+ } else {
+ ctx.RenderWithErr(ctx.Tr("repo.editor.unable_to_upload_files", form.TreePath, err), tplUploadFile, &form)
+ }
return
}