From 0e1392501daacc8372034b220593d028e2efcb52 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 22 Dec 2016 20:27:32 +0800 Subject: 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 --- routers/repo/editor.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'routers/repo') 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) -- cgit v1.2.3