Skip to content

Commit 92c09a9

Browse files
lunnylafriks
andauthored
Fix bug clone wiki (#15499)
Fix #15494 Co-authored-by: Lauris BH <[email protected]>
1 parent 8202dd1 commit 92c09a9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

routers/repo/http.go

+10
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ func httpBase(ctx *context.Context) (h *serviceHandler) {
103103

104104
isWiki := false
105105
var unitType = models.UnitTypeCode
106+
var wikiRepoName string
106107
if strings.HasSuffix(reponame, ".wiki") {
107108
isWiki = true
108109
unitType = models.UnitTypeWiki
110+
wikiRepoName = reponame
109111
reponame = reponame[:len(reponame)-5]
110112
}
111113

@@ -314,6 +316,11 @@ func httpBase(ctx *context.Context) (h *serviceHandler) {
314316
return
315317
}
316318

319+
if isWiki { // you cannot send wiki operation before create the repository
320+
ctx.HandleText(http.StatusNotFound, "Repository not found")
321+
return
322+
}
323+
317324
if owner.IsOrganization() && !setting.Repository.EnablePushCreateOrg {
318325
ctx.HandleText(http.StatusForbidden, "Push to create is not enabled for organizations.")
319326
return
@@ -363,6 +370,9 @@ func httpBase(ctx *context.Context) (h *serviceHandler) {
363370
r.URL.Path = strings.ToLower(r.URL.Path) // blue: In case some repo name has upper case name
364371

365372
dir := models.RepoPath(username, reponame)
373+
if isWiki {
374+
dir = models.RepoPath(username, wikiRepoName)
375+
}
366376

367377
return &serviceHandler{cfg, w, r, dir, cfg.Env}
368378
}

0 commit comments

Comments
 (0)