don't pull title if passed by client already

This commit is contained in:
Umputun
2019-01-05 13:47:11 -06:00
parent 0fd8657992
commit ea2d87322c
+2 -1
View File
@@ -60,13 +60,14 @@ func (s *DataStore) Create(comment store.Comment) (commentID string, err error)
return "", errors.Wrap(err, "failed to prepare comment")
}
if s.TitleExtractor != nil {
if s.TitleExtractor != nil && comment.PostTitle == "" {
if title, err := s.TitleExtractor.Get(comment.Locator.URL); err == nil {
comment.PostTitle = title
} else {
log.Printf("[WARN] failed to set title, %v", err)
}
}
return s.Interface.Create(comment)
}