1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-24 11:18:36 +00:00

Use filepath.Join instead of path.Join for file system file operations (#33978)

This commit is contained in:
Lunny Xiao
2025-03-24 14:50:28 -07:00
committed by GitHub
parent 82bc8b8ce6
commit 3fe449c21a
12 changed files with 23 additions and 56 deletions

View File

@@ -7,7 +7,6 @@ import (
"fmt"
golog "log"
"os"
"path"
"path/filepath"
"strings"
@@ -41,7 +40,7 @@ func loadLogGlobalFrom(rootCfg ConfigProvider) {
Log.BufferLen = sec.Key("BUFFER_LEN").MustInt(10000)
Log.Mode = sec.Key("MODE").MustString("console")
Log.RootPath = sec.Key("ROOT_PATH").MustString(path.Join(AppWorkPath, "log"))
Log.RootPath = sec.Key("ROOT_PATH").MustString(filepath.Join(AppWorkPath, "log"))
if !filepath.IsAbs(Log.RootPath) {
Log.RootPath = filepath.Join(AppWorkPath, Log.RootPath)
}

View File

@@ -5,7 +5,6 @@ package setting
import (
"os/exec"
"path"
"path/filepath"
"strings"
@@ -284,7 +283,7 @@ func loadRepositoryFrom(rootCfg ConfigProvider) {
Repository.GoGetCloneURLProtocol = sec.Key("GO_GET_CLONE_URL_PROTOCOL").MustString("https")
Repository.MaxCreationLimit = sec.Key("MAX_CREATION_LIMIT").MustInt(-1)
Repository.DefaultBranch = sec.Key("DEFAULT_BRANCH").MustString(Repository.DefaultBranch)
RepoRootPath = sec.Key("ROOT").MustString(path.Join(AppDataPath, "gitea-repositories"))
RepoRootPath = sec.Key("ROOT").MustString(filepath.Join(AppDataPath, "gitea-repositories"))
if !filepath.IsAbs(RepoRootPath) {
RepoRootPath = filepath.Join(AppWorkPath, RepoRootPath)
} else {
@@ -363,7 +362,7 @@ func loadRepositoryFrom(rootCfg ConfigProvider) {
}
if !filepath.IsAbs(Repository.Upload.TempPath) {
Repository.Upload.TempPath = path.Join(AppWorkPath, Repository.Upload.TempPath)
Repository.Upload.TempPath = filepath.Join(AppWorkPath, Repository.Upload.TempPath)
}
if err := loadRepoArchiveFrom(rootCfg); err != nil {

View File

@@ -5,7 +5,6 @@ package setting
import (
"os"
"path"
"path/filepath"
"strings"
"text/template"
@@ -111,7 +110,7 @@ func loadSSHFrom(rootCfg ConfigProvider) {
}
homeDir = strings.ReplaceAll(homeDir, "\\", "/")
SSH.RootPath = path.Join(homeDir, ".ssh")
SSH.RootPath = filepath.Join(homeDir, ".ssh")
serverCiphers := sec.Key("SSH_SERVER_CIPHERS").Strings(",")
if len(serverCiphers) > 0 {
SSH.ServerCiphers = serverCiphers