mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-11-01 15:01:03 +00:00
[GITEA] Add repo empty check for branch feed
- 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)
This commit is contained in:
parent
91a224ce2d
commit
2eedbe0c55
4 changed files with 73 additions and 14 deletions
|
|
@ -8,11 +8,12 @@ import (
|
|||
)
|
||||
|
||||
// RenderBranchFeed render format for branch or file
|
||||
func RenderBranchFeed(ctx *context.Context) {
|
||||
_, _, showFeedType := GetFeedType(ctx.Params(":reponame"), ctx.Req)
|
||||
if ctx.Repo.TreePath == "" {
|
||||
ShowBranchFeed(ctx, ctx.Repo.Repository, showFeedType)
|
||||
} else {
|
||||
ShowFileFeed(ctx, ctx.Repo.Repository, showFeedType)
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue