Removed unnecessary conversions (#7557)
No need to convert to the same type.
This commit is contained in:
parent
2f75766532
commit
54d96c79b5
24 changed files with 39 additions and 46 deletions
|
@ -23,5 +23,5 @@ func TestVersion(t *testing.T) {
|
||||||
|
|
||||||
var version structs.ServerVersion
|
var version structs.ServerVersion
|
||||||
DecodeJSON(t, resp, &version)
|
DecodeJSON(t, resp, &version)
|
||||||
assert.Equal(t, setting.AppVer, string(version.Version))
|
assert.Equal(t, setting.AppVer, version.Version)
|
||||||
}
|
}
|
||||||
|
|
|
@ -500,7 +500,7 @@ func getIssueFromRef(repo *Repository, ref string) (*Issue, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
issue, err := GetIssueByIndex(refRepo.ID, int64(issueIndex))
|
issue, err := GetIssueByIndex(refRepo.ID, issueIndex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if IsErrIssueNotExist(err) {
|
if IsErrIssueNotExist(err) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
@ -565,7 +565,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit, bra
|
||||||
|
|
||||||
// issue is from another repo
|
// issue is from another repo
|
||||||
if len(m[1]) > 0 && len(m[2]) > 0 {
|
if len(m[1]) > 0 && len(m[2]) > 0 {
|
||||||
refRepo, err = GetRepositoryFromMatch(string(m[1]), string(m[2]))
|
refRepo, err = GetRepositoryFromMatch(m[1], m[2])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -602,7 +602,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit, bra
|
||||||
|
|
||||||
// issue is from another repo
|
// issue is from another repo
|
||||||
if len(m[1]) > 0 && len(m[2]) > 0 {
|
if len(m[1]) > 0 && len(m[2]) > 0 {
|
||||||
refRepo, err = GetRepositoryFromMatch(string(m[1]), string(m[2]))
|
refRepo, err = GetRepositoryFromMatch(m[1], m[2])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -631,7 +631,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit, bra
|
||||||
|
|
||||||
// issue is from another repo
|
// issue is from another repo
|
||||||
if len(m[1]) > 0 && len(m[2]) > 0 {
|
if len(m[1]) > 0 && len(m[2]) > 0 {
|
||||||
refRepo, err = GetRepositoryFromMatch(string(m[1]), string(m[2]))
|
refRepo, err = GetRepositoryFromMatch(m[1], m[2])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ func (p *Permission) ColorFormat(s fmt.State) {
|
||||||
configBytes, err := unit.Config.ToDB()
|
configBytes, err := unit.Config.ToDB()
|
||||||
config = string(configBytes)
|
config = string(configBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
config = string(err.Error())
|
config = err.Error()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
format += "\nUnits[%d]: ID: %d RepoID: %d Type: %-v Config: %s"
|
format += "\nUnits[%d]: ID: %d RepoID: %d Type: %-v Config: %s"
|
||||||
|
|
|
@ -30,7 +30,7 @@ func Recovery() macaron.Handler {
|
||||||
return func(ctx *Context) {
|
return func(ctx *Context) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
combinedErr := fmt.Errorf("%s\n%s", err, string(log.Stack(2)))
|
combinedErr := fmt.Errorf("%s\n%s", err, log.Stack(2))
|
||||||
ctx.ServerError("PANIC:", combinedErr)
|
ctx.ServerError("PANIC:", combinedErr)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -25,7 +25,7 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string, cache LastCom
|
||||||
defer commitGraphFile.Close()
|
defer commitGraphFile.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := commitNodeIndex.Get(plumbing.Hash(commit.ID))
|
c, err := commitNodeIndex.Get(commit.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@ package git
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// NotesRef is the git ref where Gitea will look for git-notes data.
|
// NotesRef is the git ref where Gitea will look for git-notes data.
|
||||||
|
@ -45,7 +43,7 @@ func GetNote(repo *Repository, commitID string, note *Note) error {
|
||||||
}
|
}
|
||||||
note.Message = d
|
note.Message = d
|
||||||
|
|
||||||
commit, err := repo.gogitRepo.CommitObject(plumbing.Hash(notes.ID))
|
commit, err := repo.gogitRepo.CommitObject(notes.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing"
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing/filemode"
|
"gopkg.in/src-d/go-git.v4/plumbing/filemode"
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing/object"
|
"gopkg.in/src-d/go-git.v4/plumbing/object"
|
||||||
)
|
)
|
||||||
|
@ -57,7 +56,7 @@ func parseTreeEntries(data []byte, ptree *Tree) ([]*TreeEntry, error) {
|
||||||
return nil, fmt.Errorf("Invalid ls-tree output: %v", err)
|
return nil, fmt.Errorf("Invalid ls-tree output: %v", err)
|
||||||
}
|
}
|
||||||
entry.ID = id
|
entry.ID = id
|
||||||
entry.gogitTreeEntry.Hash = plumbing.Hash(id)
|
entry.gogitTreeEntry.Hash = id
|
||||||
pos += 41 // skip over sha and trailing space
|
pos += 41 // skip over sha and trailing space
|
||||||
|
|
||||||
end := pos + bytes.IndexByte(data[pos:], '\n')
|
end := pos + bytes.IndexByte(data[pos:], '\n')
|
||||||
|
|
|
@ -20,5 +20,5 @@ func (repo *Repository) LineBlame(revision, path, file string, line uint) (*Comm
|
||||||
if len(res) < 40 {
|
if len(res) < 40 {
|
||||||
return nil, fmt.Errorf("invalid result of blame: %s", res)
|
return nil, fmt.Errorf("invalid result of blame: %s", res)
|
||||||
}
|
}
|
||||||
return repo.GetCommit(string(res[:40]))
|
return repo.GetCommit(res[:40])
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (repo *Repository) getBlob(id SHA1) (*Blob, error) {
|
func (repo *Repository) getBlob(id SHA1) (*Blob, error) {
|
||||||
encodedObj, err := repo.gogitRepo.Storer.EncodedObject(plumbing.AnyObject, plumbing.Hash(id))
|
encodedObj, err := repo.gogitRepo.Storer.EncodedObject(plumbing.AnyObject, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ErrNotExist{id.String(), ""}
|
return nil, ErrNotExist{id.String(), ""}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,9 +86,9 @@ func convertPGPSignatureForTag(t *object.Tag) *CommitGPGSignature {
|
||||||
func (repo *Repository) getCommit(id SHA1) (*Commit, error) {
|
func (repo *Repository) getCommit(id SHA1) (*Commit, error) {
|
||||||
var tagObject *object.Tag
|
var tagObject *object.Tag
|
||||||
|
|
||||||
gogitCommit, err := repo.gogitRepo.CommitObject(plumbing.Hash(id))
|
gogitCommit, err := repo.gogitRepo.CommitObject(id)
|
||||||
if err == plumbing.ErrObjectNotFound {
|
if err == plumbing.ErrObjectNotFound {
|
||||||
tagObject, err = repo.gogitRepo.TagObject(plumbing.Hash(id))
|
tagObject, err = repo.gogitRepo.TagObject(id)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
gogitCommit, err = repo.gogitRepo.CommitObject(tagObject.Target)
|
gogitCommit, err = repo.gogitRepo.CommitObject(tagObject.Target)
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,13 +34,13 @@ func (repo *Repository) GetRefsFiltered(pattern string) ([]*Reference, error) {
|
||||||
refType := string(ObjectCommit)
|
refType := string(ObjectCommit)
|
||||||
if ref.Name().IsTag() {
|
if ref.Name().IsTag() {
|
||||||
// tags can be of type `commit` (lightweight) or `tag` (annotated)
|
// tags can be of type `commit` (lightweight) or `tag` (annotated)
|
||||||
if tagType, _ := repo.GetTagType(SHA1(ref.Hash())); err == nil {
|
if tagType, _ := repo.GetTagType(ref.Hash()); err == nil {
|
||||||
refType = tagType
|
refType = tagType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r := &Reference{
|
r := &Reference{
|
||||||
Name: ref.Name().String(),
|
Name: ref.Name().String(),
|
||||||
Object: SHA1(ref.Hash()),
|
Object: ref.Hash(),
|
||||||
Type: refType,
|
Type: refType,
|
||||||
repo: repo,
|
repo: repo,
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,10 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (repo *Repository) getTree(id SHA1) (*Tree, error) {
|
func (repo *Repository) getTree(id SHA1) (*Tree, error) {
|
||||||
gogitTree, err := repo.gogitRepo.TreeObject(plumbing.Hash(id))
|
gogitTree, err := repo.gogitRepo.TreeObject(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -41,7 +39,7 @@ func (repo *Repository) GetTree(idStr string) (*Tree, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
resolvedID := id
|
resolvedID := id
|
||||||
commitObject, err := repo.gogitRepo.CommitObject(plumbing.Hash(id))
|
commitObject, err := repo.gogitRepo.CommitObject(id)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
id = SHA1(commitObject.TreeHash)
|
id = SHA1(commitObject.TreeHash)
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ func (t *Tree) SubTree(rpath string) (*Tree, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Tree) loadTreeObject() error {
|
func (t *Tree) loadTreeObject() error {
|
||||||
gogitTree, err := t.repo.gogitRepo.TreeObject(plumbing.Hash(t.ID))
|
gogitTree, err := t.repo.gogitRepo.TreeObject(t.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing"
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing/filemode"
|
"gopkg.in/src-d/go-git.v4/plumbing/filemode"
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing/object"
|
"gopkg.in/src-d/go-git.v4/plumbing/object"
|
||||||
)
|
)
|
||||||
|
@ -23,7 +22,7 @@ func (t *Tree) GetTreeEntryByPath(relpath string) (*TreeEntry, error) {
|
||||||
gogitTreeEntry: &object.TreeEntry{
|
gogitTreeEntry: &object.TreeEntry{
|
||||||
Name: "",
|
Name: "",
|
||||||
Mode: filemode.Dir,
|
Mode: filemode.Dir,
|
||||||
Hash: plumbing.Hash(t.ID),
|
Hash: t.ID,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ func GetListLockHandler(ctx *context.Context) {
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
lock, err := models.GetLFSLockByID(int64(v))
|
lock, err := models.GetLFSLockByID(v)
|
||||||
handleLockListOut(ctx, repository, lock, err)
|
handleLockListOut(ctx, repository, lock, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,9 +378,9 @@ func (cv *ColoredValue) Format(s fmt.State, c rune) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.Write([]byte(*cv.colorBytes))
|
s.Write(*cv.colorBytes)
|
||||||
fmt.Fprintf(&protectedANSIWriter{w: s}, fmtString(s, c), *(cv.Value))
|
fmt.Fprintf(&protectedANSIWriter{w: s}, fmtString(s, c), *(cv.Value))
|
||||||
s.Write([]byte(*cv.resetBytes))
|
s.Write(*cv.resetBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetColorBytes will allow a user to set the colorBytes of a colored value
|
// SetColorBytes will allow a user to set the colorBytes of a colored value
|
||||||
|
|
|
@ -101,7 +101,7 @@ func (l *Level) UnmarshalJSON(b []byte) error {
|
||||||
|
|
||||||
switch v := tmp.(type) {
|
switch v := tmp.(type) {
|
||||||
case string:
|
case string:
|
||||||
*l = FromString(string(v))
|
*l = FromString(v)
|
||||||
case int:
|
case int:
|
||||||
*l = FromString(Level(v).String())
|
*l = FromString(Level(v).String())
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -203,7 +203,7 @@ func (logger *WriterLogger) createMsg(buf *[]byte, event *Event) {
|
||||||
(&protectedANSIWriter{
|
(&protectedANSIWriter{
|
||||||
w: &baw,
|
w: &baw,
|
||||||
mode: pawMode,
|
mode: pawMode,
|
||||||
}).Write([]byte(msg))
|
}).Write(msg)
|
||||||
*buf = baw
|
*buf = baw
|
||||||
|
|
||||||
if event.stacktrace != "" && logger.StacktraceLevel <= event.level {
|
if event.stacktrace != "" && logger.StacktraceLevel <= event.level {
|
||||||
|
|
|
@ -438,7 +438,7 @@ func shortLinkProcessorFull(ctx *postProcessCtx, node *html.Node, noLink bool) {
|
||||||
|
|
||||||
name += tail
|
name += tail
|
||||||
image := false
|
image := false
|
||||||
switch ext := filepath.Ext(string(link)); ext {
|
switch ext := filepath.Ext(link); ext {
|
||||||
// fast path: empty string, ignore
|
// fast path: empty string, ignore
|
||||||
case "":
|
case "":
|
||||||
break
|
break
|
||||||
|
@ -482,7 +482,7 @@ func shortLinkProcessorFull(ctx *postProcessCtx, node *html.Node, noLink bool) {
|
||||||
title = props["alt"]
|
title = props["alt"]
|
||||||
}
|
}
|
||||||
if title == "" {
|
if title == "" {
|
||||||
title = path.Base(string(name))
|
title = path.Base(name)
|
||||||
}
|
}
|
||||||
alt := props["alt"]
|
alt := props["alt"]
|
||||||
if alt == "" {
|
if alt == "" {
|
||||||
|
|
|
@ -27,7 +27,7 @@ func TestRender_Commits(t *testing.T) {
|
||||||
|
|
||||||
test := func(input, expected string) {
|
test := func(input, expected string) {
|
||||||
buffer := RenderString(".md", input, setting.AppSubURL, localMetas)
|
buffer := RenderString(".md", input, setting.AppSubURL, localMetas)
|
||||||
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
|
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
var sha = "b6dd6210eaebc915fd5be5579c58cce4da2e2579"
|
var sha = "b6dd6210eaebc915fd5be5579c58cce4da2e2579"
|
||||||
|
@ -51,7 +51,7 @@ func TestRender_CrossReferences(t *testing.T) {
|
||||||
|
|
||||||
test := func(input, expected string) {
|
test := func(input, expected string) {
|
||||||
buffer := RenderString("a.md", input, setting.AppSubURL, localMetas)
|
buffer := RenderString("a.md", input, setting.AppSubURL, localMetas)
|
||||||
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
|
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test(
|
||||||
|
@ -83,7 +83,7 @@ func TestRender_links(t *testing.T) {
|
||||||
|
|
||||||
test := func(input, expected string) {
|
test := func(input, expected string) {
|
||||||
buffer := RenderString("a.md", input, setting.AppSubURL, nil)
|
buffer := RenderString("a.md", input, setting.AppSubURL, nil)
|
||||||
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
|
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
|
||||||
}
|
}
|
||||||
// Text that should be turned into URL
|
// Text that should be turned into URL
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ func TestRender_email(t *testing.T) {
|
||||||
|
|
||||||
test := func(input, expected string) {
|
test := func(input, expected string) {
|
||||||
buffer := RenderString("a.md", input, setting.AppSubURL, nil)
|
buffer := RenderString("a.md", input, setting.AppSubURL, nil)
|
||||||
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
|
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
|
||||||
}
|
}
|
||||||
// Text that should be turned into email link
|
// Text that should be turned into email link
|
||||||
|
|
||||||
|
@ -214,9 +214,9 @@ func TestRender_ShortLinks(t *testing.T) {
|
||||||
|
|
||||||
test := func(input, expected, expectedWiki string) {
|
test := func(input, expected, expectedWiki string) {
|
||||||
buffer := markdown.RenderString(input, tree, nil)
|
buffer := markdown.RenderString(input, tree, nil)
|
||||||
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
|
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
|
||||||
buffer = markdown.RenderWiki([]byte(input), setting.AppSubURL, localMetas)
|
buffer = markdown.RenderWiki([]byte(input), setting.AppSubURL, localMetas)
|
||||||
assert.Equal(t, strings.TrimSpace(expectedWiki), strings.TrimSpace(string(buffer)))
|
assert.Equal(t, strings.TrimSpace(expectedWiki), strings.TrimSpace(buffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
rawtree := util.URLJoin(AppSubURL, "raw", "master")
|
rawtree := util.URLJoin(AppSubURL, "raw", "master")
|
||||||
|
|
|
@ -31,7 +31,7 @@ func TestRender_StandardLinks(t *testing.T) {
|
||||||
|
|
||||||
test := func(input, expected, expectedWiki string) {
|
test := func(input, expected, expectedWiki string) {
|
||||||
buffer := RenderString(input, setting.AppSubURL, nil)
|
buffer := RenderString(input, setting.AppSubURL, nil)
|
||||||
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
|
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
|
||||||
bufferWiki := RenderWiki([]byte(input), setting.AppSubURL, nil)
|
bufferWiki := RenderWiki([]byte(input), setting.AppSubURL, nil)
|
||||||
assert.Equal(t, strings.TrimSpace(expectedWiki), strings.TrimSpace(bufferWiki))
|
assert.Equal(t, strings.TrimSpace(expectedWiki), strings.TrimSpace(bufferWiki))
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ func TestRender_Images(t *testing.T) {
|
||||||
|
|
||||||
test := func(input, expected string) {
|
test := func(input, expected string) {
|
||||||
buffer := RenderString(input, setting.AppSubURL, nil)
|
buffer := RenderString(input, setting.AppSubURL, nil)
|
||||||
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
|
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "../../.images/src/02/train.jpg"
|
url := "../../.images/src/02/train.jpg"
|
||||||
|
|
|
@ -138,7 +138,7 @@ func readCatFileBatchCheck(catFileCheckReader *io.PipeReader, shasToBatchWriter
|
||||||
if len(fields) < 3 || fields[1] != "blob" {
|
if len(fields) < 3 || fields[1] != "blob" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
size, _ := strconv.Atoi(string(fields[2]))
|
size, _ := strconv.Atoi(fields[2])
|
||||||
if size > 1024 {
|
if size > 1024 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,7 +317,7 @@ func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *Up
|
||||||
if encoding != "UTF-8" {
|
if encoding != "UTF-8" {
|
||||||
charsetEncoding, _ := charset.Lookup(encoding)
|
charsetEncoding, _ := charset.Lookup(encoding)
|
||||||
if charsetEncoding != nil {
|
if charsetEncoding != nil {
|
||||||
result, _, err := transform.String(charsetEncoding.NewEncoder(), string(content))
|
result, _, err := transform.String(charsetEncoding.NewEncoder(), content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Look if we can't encode back in to the original we should just stick with utf-8
|
// Look if we can't encode back in to the original we should just stick with utf-8
|
||||||
log.Error("Error re-encoding %s (%s) as %s - will stay as UTF-8: %v", opts.TreePath, opts.FromTreePath, encoding, err)
|
log.Error("Error re-encoding %s (%s) as %s - will stay as UTF-8: %v", opts.TreePath, opts.FromTreePath, encoding, err)
|
||||||
|
|
|
@ -14,7 +14,6 @@ import (
|
||||||
"code.gitea.io/gitea/modules/context"
|
"code.gitea.io/gitea/modules/context"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/structs"
|
|
||||||
userSetting "code.gitea.io/gitea/routers/user/setting"
|
userSetting "code.gitea.io/gitea/routers/user/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,7 +30,7 @@ const (
|
||||||
func Settings(ctx *context.Context) {
|
func Settings(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("org.settings")
|
ctx.Data["Title"] = ctx.Tr("org.settings")
|
||||||
ctx.Data["PageIsSettingsOptions"] = true
|
ctx.Data["PageIsSettingsOptions"] = true
|
||||||
ctx.Data["CurrentVisibility"] = structs.VisibleType(ctx.Org.Organization.Visibility)
|
ctx.Data["CurrentVisibility"] = ctx.Org.Organization.Visibility
|
||||||
ctx.HTML(200, tplSettingsOptions)
|
ctx.HTML(200, tplSettingsOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +38,7 @@ func Settings(ctx *context.Context) {
|
||||||
func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
|
func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("org.settings")
|
ctx.Data["Title"] = ctx.Tr("org.settings")
|
||||||
ctx.Data["PageIsSettingsOptions"] = true
|
ctx.Data["PageIsSettingsOptions"] = true
|
||||||
ctx.Data["CurrentVisibility"] = structs.VisibleType(ctx.Org.Organization.Visibility)
|
ctx.Data["CurrentVisibility"] = ctx.Org.Organization.Visibility
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, tplSettingsOptions)
|
ctx.HTML(200, tplSettingsOptions)
|
||||||
|
|
Loading…
Reference in a new issue