We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bbf6a27 commit 4d5b265Copy full SHA for 4d5b265
modules/context/repo.go
@@ -442,7 +442,20 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) {
442
443
// redirect link to wiki
444
if strings.HasSuffix(repoName, ".wiki") {
445
- ctx.Redirect(strings.Replace(ctx.Req.RequestURI, ".wiki", "/wiki", 1))
+ parts := strings.Split(ctx.Req.RequestURI, "/")
446
+ for i := len(parts) - 1; i >= 0; i-- {
447
+ if parts[i] == repoName {
448
+ parts[i] = strings.Replace(parts[i], ".wiki", "/wiki", 1)
449
+ break
450
+ }
451
452
+
453
+ redirectLink := ""
454
+ for _, part := range parts {
455
+ redirectLink += part + "/"
456
457
458
+ ctx.Redirect(redirectLink)
459
return
460
}
461
0 commit comments