Browse Source

Added deletion of an empty line at the end of the file (#4050) (#4054)

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
tags/v1.5.0-dev
Alexey Terentyev 6 years ago
parent
commit
f86f56e19c
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      routers/repo/view.go

+ 4
- 0
routers/repo/view.go View File

@@ -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 {

Loading…
Cancel
Save