mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-15 22:38:31 +01:00
0944b7a92a
- If you attempted to get a branch feed on a empty repository, it would result in a panic as the code expects that the branch exists. - `context.RepoRefByType` would normally already 404 if the branch doesn't exist, however if a repository is empty, it would not do this check. - Fix bug where `/atom/branch/*` would return a RSS feed. (cherry picked from commitd27bcd98a4
) (cherry picked from commit07916c8723
) (cherry picked from commit2eedbe0c55
) (cherry picked from commit3810d905c6
)
19 lines
471 B
Go
19 lines
471 B
Go
// Copyright 2022 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package feed
|
|
|
|
import (
|
|
"code.gitea.io/gitea/modules/context"
|
|
)
|
|
|
|
// RenderBranchFeed render format for branch or file
|
|
func RenderBranchFeed(feedType string) func(ctx *context.Context) {
|
|
return func(ctx *context.Context) {
|
|
if ctx.Repo.TreePath == "" {
|
|
ShowBranchFeed(ctx, ctx.Repo.Repository, feedType)
|
|
} else {
|
|
ShowFileFeed(ctx, ctx.Repo.Repository, feedType)
|
|
}
|
|
}
|
|
}
|