aboutsummaryrefslogtreecommitdiffstats
path: root/modules/repofiles
diff options
context:
space:
mode:
Diffstat (limited to 'modules/repofiles')
-rw-r--r--modules/repofiles/update.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/modules/repofiles/update.go b/modules/repofiles/update.go
index 62e2afbc96..ee1b16bce9 100644
--- a/modules/repofiles/update.go
+++ b/modules/repofiles/update.go
@@ -11,17 +11,17 @@ import (
"path"
"strings"
- "golang.org/x/net/html/charset"
- "golang.org/x/text/transform"
-
"code.gitea.io/gitea/models"
- "code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/cache"
+ "code.gitea.io/gitea/modules/charset"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/lfs"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
+
+ stdcharset "golang.org/x/net/html/charset"
+ "golang.org/x/text/transform"
)
// IdentityOptions for a person's identity like an author or committer
@@ -87,15 +87,15 @@ func detectEncodingAndBOM(entry *git.TreeEntry, repo *models.Repository) (string
}
- encoding, err := base.DetectEncoding(buf)
+ encoding, err := charset.DetectEncoding(buf)
if err != nil {
// just default to utf-8 and no bom
return "UTF-8", false
}
if encoding == "UTF-8" {
- return encoding, bytes.Equal(buf[0:3], base.UTF8BOM)
+ return encoding, bytes.Equal(buf[0:3], charset.UTF8BOM)
}
- charsetEncoding, _ := charset.Lookup(encoding)
+ charsetEncoding, _ := stdcharset.Lookup(encoding)
if charsetEncoding == nil {
return "UTF-8", false
}
@@ -107,7 +107,7 @@ func detectEncodingAndBOM(entry *git.TreeEntry, repo *models.Repository) (string
}
if n > 2 {
- return encoding, bytes.Equal([]byte(result)[0:3], base.UTF8BOM)
+ return encoding, bytes.Equal([]byte(result)[0:3], charset.UTF8BOM)
}
return encoding, false
@@ -321,10 +321,10 @@ func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *Up
content := opts.Content
if bom {
- content = string(base.UTF8BOM) + content
+ content = string(charset.UTF8BOM) + content
}
if encoding != "UTF-8" {
- charsetEncoding, _ := charset.Lookup(encoding)
+ charsetEncoding, _ := stdcharset.Lookup(encoding)
if charsetEncoding != nil {
result, _, err := transform.String(charsetEncoding.NewEncoder(), content)
if err != nil {