diff --git a/routers/web/feed/convert.go b/routers/web/feed/convert.go index 6b86decaf9899..69cca02a6c6a6 100644 --- a/routers/web/feed/convert.go +++ b/routers/web/feed/convert.go @@ -230,19 +230,13 @@ func feedActionsToFeedItems(ctx *context.Context, actions models.ActionList) (it // GetFeedType return altered name and feed type, if type is empty it's no feed. func GetFeedType(name string, req *http.Request) (string, string) { - if strings.Contains(req.Header.Get("Accept"), "application/rss+xml") { - return name, "rss" - } - - if strings.Contains(req.Header.Get("Accept"), "application/atom+xml") { - return name, "atom" - } - - if strings.HasSuffix(name, ".rss") { + if strings.HasSuffix(name, ".rss") || + strings.Contains(req.Header.Get("Accept"), "application/rss+xml") { return strings.TrimSuffix(name, ".rss"), "rss" } - if strings.HasSuffix(name, ".atom") { + if strings.HasSuffix(name, ".atom") || + strings.Contains(req.Header.Get("Accept"), "application/atom+xml") { return strings.TrimSuffix(name, ".atom"), "atom" }