summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorAlexey Terentyev <axifnx@gmail.com>2018-05-29 06:08:55 +0300
committerLunny Xiao <xiaolunwen@gmail.com>2018-05-29 11:08:55 +0800
commitf86f56e19c5ef1b19eb58d888cbab25cf4b28704 (patch)
tree967aea6b8d0d68325955a93fb06bb7101d685a8a /routers
parent9aa8fdc5d7a08258b8b994dd1eda70c2685d54aa (diff)
downloadgitea-f86f56e19c5ef1b19eb58d888cbab25cf4b28704.tar.gz
gitea-f86f56e19c5ef1b19eb58d888cbab25cf4b28704.zip
Added deletion of an empty line at the end of the file (#4050) (#4054)
Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/view.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go
index ca2ece648f..d2efe30096 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -223,6 +223,10 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
var output bytes.Buffer
lines := strings.Split(fileContent, "\n")
+ //Remove blank line at the end of file
+ if len(lines) > 0 && lines[len(lines)-1] == "" {
+ lines = lines[:len(lines)-1]
+ }
for index, line := range lines {
line = gotemplate.HTMLEscapeString(line)
if index != len(lines)-1 {