aboutsummaryrefslogtreecommitdiff
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-06-09 20:05:04 -0400
committerUnknwon <u@gogs.io>2017-06-09 20:05:04 -0400
commit91f65cedc88729b5504d72647185d685083df773 (patch)
tree91eb69bfc5a99bf3e13106551d8ca8fbff33664e /routers
parent7b85ee4954f77944a4c8088c6ad8117f26d28e05 (diff)
repo/view: trim Windows line ending when display content (#4546)
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/view.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go
index a4096ff9..1ea25d51 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -186,7 +186,7 @@ func renderFile(c *context.Context, entry *git.TreeEntry, treeLink, rawLink stri
var output bytes.Buffer
lines := strings.Split(fileContent, "\n")
for index, line := range lines {
- output.WriteString(fmt.Sprintf(`<li class="L%d" rel="L%d">%s</li>`, index+1, index+1, gotemplate.HTMLEscapeString(line)) + "\n")
+ output.WriteString(fmt.Sprintf(`<li class="L%d" rel="L%d">%s</li>`, index+1, index+1, gotemplate.HTMLEscapeString(strings.TrimRight(line, "\r"))) + "\n")
}
c.Data["FileContent"] = gotemplate.HTML(output.String())