Check for empty feed title
For feeds with no title, openring places a link with no clickable text on the byline ("via ..."). Instead, we replace the empty title with a sensible substitute (URL.Host). Additionally, fix an unhandled error.
This commit is contained in:
parent
e566294050
commit
28dc22a0ff
1 changed files with 5 additions and 1 deletions
|
@ -107,6 +107,10 @@ func main() {
|
|||
log.Printf("Error fetching %s: %s", source.String(), err.Error())
|
||||
continue
|
||||
}
|
||||
if feed.Title == "" {
|
||||
log.Printf("Warning: feed from %s has no title", source.Host)
|
||||
feed.Title = source.Host
|
||||
}
|
||||
feeds = append(feeds, feed)
|
||||
log.Printf("Fetched %s", feed.Title)
|
||||
}
|
||||
|
@ -142,7 +146,7 @@ func main() {
|
|||
summary := runewidth.Truncate(
|
||||
policy.Sanitize(raw_summary), *summaryLen, "…")
|
||||
|
||||
itemLink, _ := url.Parse(item.Link)
|
||||
itemLink, err := url.Parse(item.Link)
|
||||
if err != nil {
|
||||
log.Fatal("failed parsing article URL of the feed item")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue