Skip to content

Commit

Permalink
fix: added handling of empty strings and nulls in thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
slowhigh committed Jun 12, 2024
1 parent 5a736ef commit 7ee2600
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ func publish(conf *Config, db *gorm.DB, subscription entity.Subscription) int {

if err := db.Select(
"item_title",
"LEFT(item_description, 50) as item_description",
"LEFT(item_description, 50) AS item_description",
"item_link",
"COALESCE(item_thumbnail, 'https://www.nerdplanet.app/images/feed-thumbnail.png') as item_thumbnail",
"CASE WHEN item_thumbnail = '' OR item_thumbnail IS NULL THEN 'https://www.nerdplanet.app/images/feed-thumbnail.png' ELSE item_thumbnail END AS item_thumbnail",
"feed_name",
).Where(strings.Join(where, " AND "), param...).Limit(10).Find(&items).Error; err != nil {
slog.Error(err.Error(), "error", err)
Expand Down

0 comments on commit 7ee2600

Please sign in to comment.