From cc647ba9d5854319df259377f0c89027bb9f9813 Mon Sep 17 00:00:00 2001
From: Unknwon <u@gogs.io>
Date: Mon, 15 Aug 2016 02:35:54 -0700
Subject: [PATCH] #3461 fix security issue of REAMDE path in create repository

---
 models/repo.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/models/repo.go b/models/repo.go
index 3c2c2650cb..a858338b18 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -870,7 +870,7 @@ type CreateRepoOptions struct {
 }
 
 func getRepoInitFile(tp, name string) ([]byte, error) {
-	relPath := path.Join("conf", tp, name)
+	relPath := path.Join("conf", tp, strings.TrimLeft(name, "./"))
 
 	// Use custom file when available.
 	customPath := path.Join(setting.CustomPath, relPath)