diff --git a/routers/repo/view.go b/routers/repo/view.go index 685dd411d..38694d92d 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 {