If the website URL is empty, assign the feed URL

This commit is contained in:
Frédéric Guillot 2018-01-03 18:23:21 -08:00
parent d2b137d038
commit ec63cbe7bb

View File

@ -75,6 +75,10 @@ func (h *Handler) CreateFeed(userID, categoryID int64, url string, crawler bool)
subscription.UserID = userID
subscription.Crawler = crawler
if subscription.SiteURL == "" {
subscription.SiteURL = subscription.FeedURL
}
err = h.store.CreateFeed(subscription)
if err != nil {
return nil, err
@ -171,6 +175,10 @@ func (h *Handler) RefreshFeed(userID, feedID int64) error {
originalFeed.ParsingErrorCount = 0
originalFeed.ParsingErrorMsg = ""
if originalFeed.SiteURL == "" {
originalFeed.SiteURL = originalFeed.FeedURL
}
return h.store.UpdateFeed(originalFeed)
}