repo/view: trim Windows line ending when display content (#4546)

pull/4561/head
Unknwon 2017-06-09 20:05:04 -04:00
parent 7b85ee4954
commit 91f65cedc8
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
3 changed files with 3 additions and 3 deletions

View File

@ -16,7 +16,7 @@ import (
"github.com/gogits/gogs/pkg/setting"
)
const APP_VER = "0.11.18.0608"
const APP_VER = "0.11.19.0609"
func init() {
setting.AppVer = APP_VER

View File

@ -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())

View File

@ -1 +1 @@
0.11.18.0608
0.11.19.0609