aboutsummaryrefslogtreecommitdiffstats
path: root/routers/private/serv.go
diff options
context:
space:
mode:
authorConcurrentCrab <102517200+ConcurrentCrab@users.noreply.github.com>2024-09-27 19:57:37 +0530
committerGitHub <noreply@github.com>2024-09-27 10:27:37 -0400
commit8a9fd7f771f4f694594a0652e95ddda2b7479b3e (patch)
treeeaad5bf33ca2a745645fc2368b4b01d598e35486 /routers/private/serv.go
parentfdb1df9eca2f7adabf08883042325af26c3fd509 (diff)
downloadgitea-8a9fd7f771f4f694594a0652e95ddda2b7479b3e.tar.gz
gitea-8a9fd7f771f4f694594a0652e95ddda2b7479b3e.zip
Add pure SSH LFS support (#31516)
Fixes #17554 /claim #17554 Docs PR https://gitea.com/gitea/docs/pulls/49 To test, run pushes like: `GIT_TRACE=1` git push. The trace output should mention "pure SSH connection".
Diffstat (limited to 'routers/private/serv.go')
-rw-r--r--routers/private/serv.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/routers/private/serv.go b/routers/private/serv.go
index dbb28cc2bb..4dd7d06fb3 100644
--- a/routers/private/serv.go
+++ b/routers/private/serv.go
@@ -136,16 +136,15 @@ func ServCommand(ctx *context.PrivateContext) {
if err != nil {
if repo_model.IsErrRepoNotExist(err) {
repoExist = false
- for _, verb := range ctx.FormStrings("verb") {
- if verb == "git-upload-pack" {
- // User is fetching/cloning a non-existent repository
- log.Warn("Failed authentication attempt (cannot find repository: %s/%s) from %s", results.OwnerName, results.RepoName, ctx.RemoteAddr())
- ctx.JSON(http.StatusNotFound, private.Response{
- UserMsg: fmt.Sprintf("Cannot find repository: %s/%s", results.OwnerName, results.RepoName),
- })
- return
- }
+ if mode == perm.AccessModeRead {
+ // User is fetching/cloning a non-existent repository
+ log.Warn("Failed authentication attempt (cannot find repository: %s/%s) from %s", results.OwnerName, results.RepoName, ctx.RemoteAddr())
+ ctx.JSON(http.StatusNotFound, private.Response{
+ UserMsg: fmt.Sprintf("Cannot find repository: %s/%s", results.OwnerName, results.RepoName),
+ })
+ return
}
+ // else fallthrough (push-to-create may kick in below)
} else {
log.Error("Unable to get repository: %s/%s Error: %v", results.OwnerName, results.RepoName, err)
ctx.JSON(http.StatusInternalServerError, private.Response{