repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
afce979
parent
9a89178
author
Antonio Mika
date
2023-02-24 15:15:38 +0000 UTC
Fix feeds panic and lists lint
2 files changed,  +2, -3
M feeds/cron.go
+1, -1
1@@ -223,7 +223,7 @@ func (f *Fetcher) Fetch(fp *gofeed.Parser, url string, lastDigest *time.Time) (*
2 	items := []*FeedItem{}
3 	// we only want to return feed items published since the last digest time we fetched
4 	for _, item := range feed.Items {
5-		if lastDigest != nil && item.PublishedParsed.Before(*lastDigest) {
6+		if item == nil || (item.PublishedParsed != nil && lastDigest != nil && item.PublishedParsed.Before(*lastDigest)) {
7 			continue
8 		}
9 
M lists/api.go
+1, -2
 1@@ -93,7 +93,6 @@ func getPostsForUser(r *http.Request, user *db.User, tag string, num int) ([]*db
 2 	cfg := shared.GetCfg(r)
 3 	var err error
 4 
 5-	posts := make([]*db.Post, 0)
 6 	pager := &db.Pager{Num: num, Page: 0}
 7 	var p *db.Paginate[*db.Post]
 8 	if tag == "" {
 9@@ -101,7 +100,7 @@ func getPostsForUser(r *http.Request, user *db.User, tag string, num int) ([]*db
10 	} else {
11 		p, err = dbpool.FindUserPostsByTag(pager, tag, user.ID, cfg.Space)
12 	}
13-	posts = p.Data
14+	posts := p.Data
15 
16 	if err != nil {
17 		return posts, err