mirror of
https://github.com/go-gitea/gitea
synced 2024-11-26 16:12:58 +01:00
Fix #219
This commit is contained in:
parent
617bbe3fee
commit
422043f422
1 changed files with 6 additions and 2 deletions
|
@ -5,6 +5,7 @@
|
||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -82,7 +83,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
||||||
|
|
||||||
authStr := strings.Replace(fmt.Sprintf("://%s:%s",
|
authStr := strings.Replace(fmt.Sprintf("://%s:%s",
|
||||||
form.AuthUserName, form.AuthPasswd), "@", "%40", -1)
|
form.AuthUserName, form.AuthPasswd), "@", "%40", -1)
|
||||||
url := strings.Replace(form.Url, "://", authStr, 1) + "@"
|
url := strings.Replace(form.Url, "://", authStr+"@", 1)
|
||||||
repo, err := models.MigrateRepository(ctx.User, form.RepoName, form.Description, form.Private,
|
repo, err := models.MigrateRepository(ctx.User, form.RepoName, form.Description, form.Private,
|
||||||
form.Mirror, url)
|
form.Mirror, url)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -254,8 +255,11 @@ func Single(ctx *middleware.Context, params martini.Params) {
|
||||||
if isTextFile {
|
if isTextFile {
|
||||||
d, _ := ioutil.ReadAll(dataRc)
|
d, _ := ioutil.ReadAll(dataRc)
|
||||||
buf = append(buf, d...)
|
buf = append(buf, d...)
|
||||||
if base.IsMarkdownFile(readmeFile.Name()) {
|
switch {
|
||||||
|
case base.IsMarkdownFile(readmeFile.Name()):
|
||||||
buf = base.RenderMarkdown(buf, branchLink)
|
buf = base.RenderMarkdown(buf, branchLink)
|
||||||
|
default:
|
||||||
|
buf = bytes.Replace(buf, []byte("\n"), []byte(`<br>`), -1)
|
||||||
}
|
}
|
||||||
ctx.Data["FileContent"] = string(buf)
|
ctx.Data["FileContent"] = string(buf)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue