aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorJohn Olheiser <42128690+jolheiser@users.noreply.github.com>2020-02-05 03:40:35 -0600
committerGitHub <noreply@github.com>2020-02-05 10:40:35 +0100
commit95013fde60748c425eb910dcab5d1fdd1c89ae18 (patch)
treebe73a9f9669fafe0788bd042a567cd43004da78f /routers
parent7dcd305424e1d3bfb1fc2b1eaa02ed47a83bddec (diff)
downloadgitea-95013fde60748c425eb910dcab5d1fdd1c89ae18.tar.gz
gitea-95013fde60748c425eb910dcab5d1fdd1c89ae18.zip
Fix push-create SSH bugs (#10145)
* Attempt to fix push-create SSH bugs Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix binding Signed-off-by: jolheiser <john.olheiser@gmail.com> * Invalid ctx Signed-off-by: jolheiser <john.olheiser@gmail.com>
Diffstat (limited to 'routers')
-rw-r--r--routers/private/serv.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/routers/private/serv.go b/routers/private/serv.go
index c769f30d07..91c28143ee 100644
--- a/routers/private/serv.go
+++ b/routers/private/serv.go
@@ -68,7 +68,6 @@ func ServNoCommand(ctx *macaron.Context) {
// ServCommand returns information about the provided keyid
func ServCommand(ctx *macaron.Context) {
- // Although we provide the verbs we don't need them at present they're just for logging purposes
keyID := ctx.ParamsInt64(":keyid")
ownerName := ctx.Params(":owner")
repoName := ctx.Params(":repo")
@@ -105,6 +104,17 @@ func ServCommand(ctx *macaron.Context) {
if err != nil {
if models.IsErrRepoNotExist(err) {
repoExist = false
+ for _, verb := range ctx.QueryStrings("verb") {
+ if "git-upload-pack" == verb {
+ // User is fetching/cloning a non-existent repository
+ ctx.JSON(http.StatusNotFound, map[string]interface{}{
+ "results": results,
+ "type": "ErrRepoNotExist",
+ "err": fmt.Sprintf("Cannot find repository: %s/%s", results.OwnerName, results.RepoName),
+ })
+ return
+ }
+ }
} else {
log.Error("Unable to get repository: %s/%s Error: %v", results.OwnerName, results.RepoName, err)
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{