From 0cfacdd48db6bdfb6d34867dbaf1edafdb589f8e Mon Sep 17 00:00:00 2001 From: PantsuDev Date: Mon, 19 Jun 2017 09:55:09 +1000 Subject: [PATCH] Fix up rss handler spec violations --- router/rss_handler.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/router/rss_handler.go b/router/rss_handler.go index 7199a413..b68d15da 100644 --- a/router/rss_handler.go +++ b/router/rss_handler.go @@ -5,6 +5,7 @@ import ( "html" "net/http" "strconv" + "strings" "time" "sort" @@ -43,13 +44,12 @@ func RSSHandler(w http.ResponseWriter, r *http.Request) { torrentJSON := torrent.ToJSON() feed.Items[i] = &nyaafeeds.RssItem{ Title: torrentJSON.Name, - Link: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), + Link: config.WebAddress() + "/download/" + torrentJSON.Hash, Description: string(torrentJSON.Description), - Author: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), - PubDate: torrent.Date.String(), - GUID: config.WebAddress() + "/download/" + torrentJSON.Hash, + PubDate: torrent.Date.Format(time.RFC822), + GUID: config.WebAddress() + "view" + strconv.FormatUint(uint64(torrentJSON.ID), 10), Enclosure: &nyaafeeds.RssEnclosure{ - URL: config.WebAddress() + "/download/" + torrentJSON.Hash, + URL: config.WebAddress() + "/download/" + strings.TrimSpace(torrentJSON.Hash), Length: strconv.FormatUint(uint64(torrentJSON.Filesize), 10), Type: "application/x-bittorrent", }, @@ -97,10 +97,10 @@ func RSSEztvHandler(w http.ResponseWriter, r *http.Request) { }, Description: string(torrentJSON.Description), Comments: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), - PubDate: torrent.Date.String(), + PubDate: torrent.Date.Format(time.RFC822), GUID: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), Enclosure: &nyaafeeds.RssEnclosure{ - URL: config.WebAddress() + "/download/" + torrentJSON.Hash, + URL: config.WebAddress() + "/download/" + strings.TrimSpace(torrentJSON.Hash), Length: strconv.FormatUint(uint64(torrentJSON.Filesize), 10), Type: "application/x-bittorrent", }, @@ -242,10 +242,10 @@ func RSSTorznabHandler(w http.ResponseWriter, r *http.Request) { }, Description: string(torrentJSON.Description), Comments: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), - PubDate: torrent.Date.String(), + PubDate: torrent.Date.Format(time.RFC822), GUID: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), Enclosure: &nyaafeeds.RssEnclosure{ - URL: config.WebAddress() + "/download/" + torrentJSON.Hash, + URL: config.WebAddress() + "/download/" + strings.TrimSpace(torrentJSON.Hash), Length: strconv.FormatUint(uint64(torrentJSON.Filesize), 10), Type: "application/x-bittorrent", },