aboutsummaryrefslogtreecommitdiffstats
path: root/modules/auth/repo_form.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/auth/repo_form.go')
-rw-r--r--modules/auth/repo_form.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go
index f27812bb1b..2d6f89b6ed 100644
--- a/modules/auth/repo_form.go
+++ b/modules/auth/repo_form.go
@@ -10,13 +10,14 @@ import (
"strings"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
+ "code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/routers/utils"
"gitea.com/macaron/binding"
"gitea.com/macaron/macaron"
- "github.com/unknwon/com"
)
// _______________________________________ _________.______________________ _______________.___.
@@ -107,8 +108,15 @@ func ParseRemoteAddr(remoteAddr, authUsername, authPassword string, user *models
}
} else if !user.CanImportLocal() {
return "", models.ErrInvalidCloneAddr{IsPermissionDenied: true}
- } else if !com.IsDir(remoteAddr) {
- return "", models.ErrInvalidCloneAddr{IsInvalidPath: true}
+ } else {
+ isDir, err := util.IsDir(remoteAddr)
+ if err != nil {
+ log.Error("Unable to check if %s is a directory: %v", remoteAddr, err)
+ return "", err
+ }
+ if !isDir {
+ return "", models.ErrInvalidCloneAddr{IsInvalidPath: true}
+ }
}
return remoteAddr, nil