Bug fix with empty titles

The code for title retrieval previously assumed that meta tags concerned
with the title would always contain a value but some sites leave the value
empty thus it had to be checked for as well.
This commit is contained in:
Kenneth Gitere 2021-02-09 12:56:07 +03:00
parent 65fdd967c1
commit f0a610c2ac

View file

@ -462,7 +462,12 @@ impl Readability {
.iter() .iter()
.find(|key| values.contains_key(**key)) .find(|key| values.contains_key(**key))
{ {
values.get(*key).map(|title| title.to_owned()).unwrap() let title = values.get(*key).map(|title| title.to_owned()).unwrap();
if title.is_empty() {
self.get_article_title()
} else {
title
}
} else { } else {
self.get_article_title() self.get_article_title()
}; };