diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-04-16 02:57:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-15 19:57:19 +0100 |
commit | 92c09a90f78990216ae4358c988a6e94c324c9e5 (patch) | |
tree | d587a6efedf1fc0ce07005dd32344535c051a1e1 | |
parent | 8202dd131189102d2531c853665d213e43a5c818 (diff) | |
download | gitea-92c09a90f78990216ae4358c988a6e94c324c9e5.tar.gz gitea-92c09a90f78990216ae4358c988a6e94c324c9e5.zip |
Fix bug clone wiki (#15499)
Fix #15494
Co-authored-by: Lauris BH <lauris@nix.lv>
-rw-r--r-- | routers/repo/http.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go index 2b79dddbbd..95a56e4a2c 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -103,9 +103,11 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { isWiki := false var unitType = models.UnitTypeCode + var wikiRepoName string if strings.HasSuffix(reponame, ".wiki") { isWiki = true unitType = models.UnitTypeWiki + wikiRepoName = reponame reponame = reponame[:len(reponame)-5] } @@ -314,6 +316,11 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { return } + if isWiki { // you cannot send wiki operation before create the repository + ctx.HandleText(http.StatusNotFound, "Repository not found") + return + } + if owner.IsOrganization() && !setting.Repository.EnablePushCreateOrg { ctx.HandleText(http.StatusForbidden, "Push to create is not enabled for organizations.") return @@ -363,6 +370,9 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { r.URL.Path = strings.ToLower(r.URL.Path) // blue: In case some repo name has upper case name dir := models.RepoPath(username, reponame) + if isWiki { + dir = models.RepoPath(username, wikiRepoName) + } return &serviceHandler{cfg, w, r, dir, cfg.Env} } |