Compare commits

..

3 Commits

Author SHA1 Message Date
icefed
f5d59ed14e
Merge ee34959d7c7c5a7e689026f1825e14e661e5a034 into 479aebd0233daea2b46fd65c90a6134f133e3c15 2023-09-01 18:59:46 +02:00
Nazar Kanaev
479aebd023 update changelog 2023-09-01 17:40:13 +01:00
Nazar Kanaev
9b178d1fb3 fix relative article links 2023-09-01 17:38:37 +01:00
2 changed files with 10 additions and 0 deletions

View File

@ -1,6 +1,7 @@
# upcoming
- (fix) duplicate articles caused by the same feed addition (thanks to @adaszko)
- (fix) relative article links (thanks to @adazsko for the report)
# v2.4 (2023-08-15)

View File

@ -12,6 +12,7 @@ import (
"strings"
"github.com/nkanaev/yarr/src/assets"
"github.com/nkanaev/yarr/src/content/htmlutil"
"github.com/nkanaev/yarr/src/content/readability"
"github.com/nkanaev/yarr/src/content/sanitizer"
"github.com/nkanaev/yarr/src/content/silo"
@ -313,6 +314,14 @@ func (s *Server) handleItem(c *router.Context) {
c.Out.WriteHeader(http.StatusBadRequest)
return
}
// runtime fix for relative links
if !strings.HasPrefix(item.Link, "http") {
if feed := s.db.GetFeed(item.FeedId); feed != nil {
item.Link = htmlutil.AbsoluteUrl(item.Link, feed.Link)
}
}
item.Content = sanitizer.Sanitize(item.Link, item.Content)
c.JSON(http.StatusOK, item)