Browse Source

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

pull/4561/head
Unknwon 8 years ago
parent
commit
91f65cedc8
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 2
      gogs.go
  2. 2
      routers/repo/view.go
  3. 2
      templates/.VERSION

2
gogs.go

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

2
routers/repo/view.go

@ -186,7 +186,7 @@ func renderFile(c *context.Context, entry *git.TreeEntry, treeLink, rawLink stri
var output bytes.Buffer var output bytes.Buffer
lines := strings.Split(fileContent, "\n") lines := strings.Split(fileContent, "\n")
for index, line := range lines { 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()) c.Data["FileContent"] = gotemplate.HTML(output.String())

2
templates/.VERSION

@ -1 +1 @@
0.11.18.0608 0.11.19.0609
Loading…
Cancel
Save