Skip to content

Commit 81ec54e

Browse files
committed
Fix atom/rss mixed error
1 parent 4b19e29 commit 81ec54e

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

routers/web/feed/render.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ import (
88
)
99

1010
// RenderBranchFeed render format for branch or file
11-
func RenderBranchFeed(ctx *context.Context) {
12-
_, showFeedType := GetFeedType(ctx.PathParam("reponame"), ctx.Req)
11+
func RenderBranchFeedRSS(ctx *context.Context) {
1312
if ctx.Repo.TreePath == "" {
14-
ShowBranchFeed(ctx, ctx.Repo.Repository, showFeedType)
13+
ShowBranchFeed(ctx, ctx.Repo.Repository, "rss")
1514
} else {
16-
ShowFileFeed(ctx, ctx.Repo.Repository, showFeedType)
15+
ShowFileFeed(ctx, ctx.Repo.Repository, "rss")
16+
}
17+
}
18+
19+
func RenderBranchFeedAtom(ctx *context.Context) {
20+
if ctx.Repo.TreePath == "" {
21+
ShowBranchFeed(ctx, ctx.Repo.Repository, "atom")
22+
} else {
23+
ShowFileFeed(ctx, ctx.Repo.Repository, "atom")
1724
}
1825
}

routers/web/web.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,8 +1615,8 @@ func registerWebRoutes(m *web.Router) {
16151615
m.Get("/cherry-pick/{sha:([a-f0-9]{7,64})$}", repo.SetEditorconfigIfExists, context.RepoRefByDefaultBranch(), repo.CherryPick)
16161616
}, repo.MustBeNotEmpty)
16171617

1618-
m.Get("/rss/branch/*", context.RepoRefByType(git.RefTypeBranch), feedEnabled, feed.RenderBranchFeed)
1619-
m.Get("/atom/branch/*", context.RepoRefByType(git.RefTypeBranch), feedEnabled, feed.RenderBranchFeed)
1618+
m.Get("/rss/branch/*", context.RepoRefByType(git.RefTypeBranch), feedEnabled, feed.RenderBranchFeedRSS)
1619+
m.Get("/atom/branch/*", context.RepoRefByType(git.RefTypeBranch), feedEnabled, feed.RenderBranchFeedAtom)
16201620

16211621
m.Group("/src", func() {
16221622
m.Get("", func(ctx *context.Context) { ctx.Redirect(ctx.Repo.RepoLink) }) // there is no "{owner}/{repo}/src" page, so redirect to "{owner}/{repo}" to avoid 404

0 commit comments

Comments
 (0)