summaryrefslogtreecommitdiffstats
path: root/routers/repo/http.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-04-14 23:22:00 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-04-14 23:22:00 +0800
commit4210f56dbcf0940f5cb181022501ec6fee5eebbb (patch)
tree15033383a6e826d67730e2a4bcabe9ac439c4e20 /routers/repo/http.go
parent6cb636f8a0cd9e3fd8831c1a4dd597d965c93509 (diff)
downloadgitea-4210f56dbcf0940f5cb181022501ec6fee5eebbb.tar.gz
gitea-4210f56dbcf0940f5cb181022501ec6fee5eebbb.zip
bug fixed for http clone
Diffstat (limited to 'routers/repo/http.go')
-rw-r--r--routers/repo/http.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go
index d4956deffe..ab48c6f3d7 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -10,6 +10,7 @@ import (
"os"
"os/exec"
"path"
+ "path/filepath"
"regexp"
"strconv"
"strings"
@@ -333,7 +334,7 @@ func sendFile(contentType string, hr handler) {
http.ServeFile(w, r, reqFile)
}
-func getGitDir(config *Config, filePath string) (string, error) {
+func getGitDir(config *Config, fPath string) (string, error) {
root := config.ReposRoot
if root == "" {
@@ -347,7 +348,11 @@ func getGitDir(config *Config, filePath string) (string, error) {
root = cwd
}
- f := path.Join(root, filePath)
+ if !strings.HasSuffix(fPath, ".git") {
+ fPath = fPath + ".git"
+ }
+
+ f := filepath.Join(root, fPath)
if _, err := os.Stat(f); os.IsNotExist(err) {
return "", err
}