diff options
author | Stefan Grönke <stefan@gronke.org> | 2016-12-22 05:49:56 +0100 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2016-12-21 23:49:56 -0500 |
commit | 3376354ed8a38c6a3c4f27d6a1111cfa8f739089 (patch) | |
tree | 16a0c5d8361c212396f76991e2508ce0f0f75461 /routers/repo/editor.go | |
parent | c2e1370588b041657cb8c196a2f08aaaf5a83bef (diff) |
Check if file is a symlink with web editor (#3687)
* editor checks for symlinks
* translate file_is_a_symlink message
* credit translation author
Diffstat (limited to 'routers/repo/editor.go')
-rw-r--r-- | routers/repo/editor.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/repo/editor.go b/routers/repo/editor.go index d4d49fda..c88ca7d6 100644 --- a/routers/repo/editor.go +++ b/routers/repo/editor.go @@ -184,6 +184,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), EDIT_FILE, &form) + return + } if entry.IsDir() { ctx.Data["Err_TreePath"] = true ctx.RenderWithErr(ctx.Tr("repo.editor.filename_is_a_directory", part), EDIT_FILE, &form) |