diff options
author | niphor <niphor@gmail.com> | 2014-06-24 14:28:47 +0800 |
---|---|---|
committer | niphor <niphor@gmail.com> | 2014-06-24 14:28:47 +0800 |
commit | 29a40c97f367a432e4038f20f09d7bf76ce4ab93 (patch) | |
tree | 4c920f083f26377c24475cc61a9782c5eff79fb1 /modules | |
parent | bf703ef61761fc4b09e3cb95672869520eccbc39 (diff) | |
download | gitea-29a40c97f367a432e4038f20f09d7bf76ce4ab93.tar.gz gitea-29a40c97f367a432e4038f20f09d7bf76ce4ab93.zip |
RepoRootPath must be absolute path
Diffstat (limited to 'modules')
-rw-r--r-- | modules/setting/setting.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 1298996396..cb7734bb32 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -182,6 +182,12 @@ func NewConfigContext() { log.Fatal("Fail to get home directory: %v", err) } RepoRootPath = Cfg.MustValue("repository", "ROOT", filepath.Join(homeDir, "gogs-repositories")) + if !filepath.IsAbs(RepoRootPath) { + RepoRootPath = filepath.Join(workDir, RepoRootPath) + } else { + RepoRootPath = filepath.Clean(RepoRootPath) + } + if err = os.MkdirAll(RepoRootPath, os.ModePerm); err != nil { log.Fatal("Fail to create repository root path(%s): %v", RepoRootPath, err) } |