summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2015-02-14 17:49:33 -0500
committerUnknwon <joe2010xtmf@163.com>2015-02-14 17:49:33 -0500
commitf625665d8d72fdc4d2ce28a88aaaf01eaf5c2370 (patch)
tree29d6fe9a9138973ed8335a950aa86b14228446a6 /modules
parentd047811c1a34640c5de751b638f1cb477fd595bc (diff)
downloadgitea-f625665d8d72fdc4d2ce28a88aaaf01eaf5c2370.tar.gz
gitea-f625665d8d72fdc4d2ce28a88aaaf01eaf5c2370.zip
modules/setting: add abs path check before add workdir prefix
Diffstat (limited to 'modules')
-rw-r--r--modules/setting/setting.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 6664c41907..52dca3f041 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -240,7 +240,10 @@ func NewConfigContext() {
ReverseProxyAuthUser = sec.Key("REVERSE_PROXY_AUTHENTICATION_USER").MustString("X-WEBAUTH-USER")
sec = Cfg.Section("attachment")
- AttachmentPath = path.Join(workDir, sec.Key("PATH").MustString("data/attachments"))
+ AttachmentPath = sec.Key("PATH").MustString("data/attachments")
+ if !filepath.IsAbs(AttachmentPath) {
+ AttachmentPath = path.Join(workDir, AttachmentPath)
+ }
AttachmentAllowedTypes = sec.Key("ALLOWED_TYPES").MustString("image/jpeg|image/png")
AttachmentMaxSize = sec.Key("MAX_SIZE").MustInt64(32)
AttachmentMaxFiles = sec.Key("MAX_FILES").MustInt(10)
@@ -297,7 +300,10 @@ func NewConfigContext() {
sec = Cfg.Section("picture")
PictureService = sec.Key("SERVICE").In("server", []string{"server"})
- AvatarUploadPath = path.Join(workDir, sec.Key("AVATAR_UPLOAD_PATH").MustString("data/avatars"))
+ AvatarUploadPath = sec.Key("AVATAR_UPLOAD_PATH").MustString("data/avatars")
+ if !filepath.IsAbs(AvatarUploadPath) {
+ AvatarUploadPath = path.Join(workDir, AvatarUploadPath)
+ }
os.MkdirAll(AvatarUploadPath, os.ModePerm)
switch sec.Key("GRAVATAR_SOURCE").MustString("gravatar") {
case "duoshuo":