From 5210572129c9268b1ebedd20fd3ab6d89f492526 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 12 Mar 2022 17:12:29 +0100 Subject: [PATCH] allow feed suffix and feed header --- routers/web/feed/convert.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) 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" }