Skip to content

Commit 5210572

Browse files
committed
allow feed suffix and feed header
1 parent 3ce0c67 commit 5210572

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

routers/web/feed/convert.go

+4-10
Original file line numberDiff line numberDiff line change
@@ -230,19 +230,13 @@ func feedActionsToFeedItems(ctx *context.Context, actions models.ActionList) (it
230230

231231
// GetFeedType return altered name and feed type, if type is empty it's no feed.
232232
func GetFeedType(name string, req *http.Request) (string, string) {
233-
if strings.Contains(req.Header.Get("Accept"), "application/rss+xml") {
234-
return name, "rss"
235-
}
236-
237-
if strings.Contains(req.Header.Get("Accept"), "application/atom+xml") {
238-
return name, "atom"
239-
}
240-
241-
if strings.HasSuffix(name, ".rss") {
233+
if strings.HasSuffix(name, ".rss") ||
234+
strings.Contains(req.Header.Get("Accept"), "application/rss+xml") {
242235
return strings.TrimSuffix(name, ".rss"), "rss"
243236
}
244237

245-
if strings.HasSuffix(name, ".atom") {
238+
if strings.HasSuffix(name, ".atom") ||
239+
strings.Contains(req.Header.Get("Accept"), "application/atom+xml") {
246240
return strings.TrimSuffix(name, ".atom"), "atom"
247241
}
248242

0 commit comments

Comments
 (0)