From b4802b9b2eae044e35f022dc7116986e4762a944 Mon Sep 17 00:00:00 2001 From: Xinyu Zhou Date: Mon, 21 Nov 2022 13:14:58 +0800 Subject: Allow disable RSS/Atom feed (#21622) This patch provide a mechanism to disable RSS/Atom feed. Signed-off-by: Xinyu Zhou Co-authored-by: Lunny Xiao Co-authored-by: 6543 <6543@obermui.de> --- modules/context/repo.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modules/context') diff --git a/modules/context/repo.go b/modules/context/repo.go index 1a0263a330..c363c36994 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -441,8 +441,10 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) { userName := ctx.Params(":username") repoName := ctx.Params(":reponame") repoName = strings.TrimSuffix(repoName, ".git") - repoName = strings.TrimSuffix(repoName, ".rss") - repoName = strings.TrimSuffix(repoName, ".atom") + if setting.EnableFeed { + repoName = strings.TrimSuffix(repoName, ".rss") + repoName = strings.TrimSuffix(repoName, ".atom") + } // Check if the user is the same as the repository owner if ctx.IsSigned && ctx.Doer.LowerName == strings.ToLower(userName) { -- cgit v1.2.3