diff --git a/routes/repo/view.go b/routes/repo/view.go index f34ed6773..7c15af8f0 100644 --- a/routes/repo/view.go +++ b/routes/repo/view.go @@ -185,6 +185,10 @@ func renderFile(c *context.Context, entry *git.TreeEntry, treeLink, rawLink stri var output bytes.Buffer lines := strings.Split(fileContent, "\n") + // Remove blank line at the end of file + if len(lines) > 0 && len(lines[len(lines)-1])==0 { + lines = lines[:len(lines)-1] + } for index, line := range lines { output.WriteString(fmt.Sprintf(`
  • %s
  • `, index+1, index+1, gotemplate.HTMLEscapeString(strings.TrimRight(line, "\r"))) + "\n") }