1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-23 17:14:27 +00:00
This commit is contained in:
Unknown 2014-05-30 16:35:35 -04:00
parent 617bbe3fee
commit 422043f422

View File

@ -5,6 +5,7 @@
package repo
import (
"bytes"
"encoding/base64"
"errors"
"fmt"
@ -82,7 +83,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
authStr := strings.Replace(fmt.Sprintf("://%s:%s",
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,
form.Mirror, url)
if err == nil {
@ -254,8 +255,11 @@ func Single(ctx *middleware.Context, params martini.Params) {
if isTextFile {
d, _ := ioutil.ReadAll(dataRc)
buf = append(buf, d...)
if base.IsMarkdownFile(readmeFile.Name()) {
switch {
case base.IsMarkdownFile(readmeFile.Name()):
buf = base.RenderMarkdown(buf, branchLink)
default:
buf = bytes.Replace(buf, []byte("\n"), []byte(`<br>`), -1)
}
ctx.Data["FileContent"] = string(buf)
}