Skip to content

Commit

Permalink
Added deletion of an empty line at the end of the file (go-gitea#4050) (
Browse files Browse the repository at this point in the history
go-gitea#4054)

Signed-off-by: Alexey Terentyev <[email protected]>
  • Loading branch information
axifive authored and lunny committed May 29, 2018
1 parent 9aa8fdc commit f86f56e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions routers/repo/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f86f56e

Please sign in to comment.