summaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2016-12-22 20:27:32 +0800
committerThomas Boerger <thomas@webhippie.de>2016-12-22 13:27:32 +0100
commit0e1392501daacc8372034b220593d028e2efcb52 (patch)
treede541650b7f5a29d142a105b2fe4bd5da0a95742 /routers/repo
parente0ecd9fd93c5e59bd4ad1d10acacb13420ff5301 (diff)
downloadgitea-0e1392501daacc8372034b220593d028e2efcb52.tar.gz
gitea-0e1392501daacc8372034b220593d028e2efcb52.zip
Check if file is a symlink with web editor (#3687) (#445)
* Check if file is a symlink with web editor (#3687) * editor checks for symlinks * translate file_is_a_symlink message * credit translation author * fix error constant
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/editor.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/repo/editor.go b/routers/repo/editor.go
index 8d45521a2e..0c42204722 100644
--- a/routers/repo/editor.go
+++ b/routers/repo/editor.go
@@ -186,6 +186,11 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
return
}
} else {
+ if entry.IsLink() {
+ ctx.Data["Err_TreePath"] = true
+ ctx.RenderWithErr(ctx.Tr("repo.editor.file_is_a_symlink", part), tplEditFile, &form)
+ return
+ }
if entry.IsDir() {
ctx.Data["Err_TreePath"] = true
ctx.RenderWithErr(ctx.Tr("repo.editor.filename_is_a_directory", part), tplEditFile, &form)