Fix dashboard failing to load episodes after RSS import
Build and Deploy / build-and-deploy (push) Successful in 52s
Build and Deploy / build-and-deploy (push) Successful in 52s
The root cause was that modernc.org/sqlite stores time.Time as strings but cannot scan strings back into time.Time, causing ListEpisodes to fail. Changed PublishedAt and CreatedAt in store structs from time.Time to string, with format/parse handled at the application level. Also fixed a secondary issue where the published_at format stored during import had a duplicated timezone offset.
This commit is contained in:
+5
-1
@@ -104,6 +104,10 @@ func (h *RSSHandler) ServeRSS(w http.ResponseWriter, r *http.Request) {
|
||||
itemImage = &rssItunesImage{Href: h.fullURL(epImage)}
|
||||
}
|
||||
|
||||
pubStr := ep.PublishedAt
|
||||
if pt, err := time.Parse("2006-01-02 15:04:05", ep.PublishedAt); err == nil {
|
||||
pubStr = pt.Format(time.RFC1123Z)
|
||||
}
|
||||
items = append(items, rssItem{
|
||||
Title: ep.Title,
|
||||
Description: ep.Description,
|
||||
@@ -111,7 +115,7 @@ func (h *RSSHandler) ServeRSS(w http.ResponseWriter, r *http.Request) {
|
||||
URL: h.fullURL(ep.AudioPath),
|
||||
Type: "audio/mpeg",
|
||||
},
|
||||
PubDate: ep.PublishedAt.Format(time.RFC1123Z),
|
||||
PubDate: pubStr,
|
||||
GUID: h.fullURL(ep.AudioPath),
|
||||
ItunesImage: itemImage,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user