Skip to content

Commit f86f56e

Browse files
axifivelunny
authored andcommitted
Added deletion of an empty line at the end of the file (#4050) (#4054)
Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
1 parent 9aa8fdc commit f86f56e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

routers/repo/view.go

+4
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
223223

224224
var output bytes.Buffer
225225
lines := strings.Split(fileContent, "\n")
226+
//Remove blank line at the end of file
227+
if len(lines) > 0 && lines[len(lines)-1] == "" {
228+
lines = lines[:len(lines)-1]
229+
}
226230
for index, line := range lines {
227231
line = gotemplate.HTMLEscapeString(line)
228232
if index != len(lines)-1 {

0 commit comments

Comments
 (0)