diff --git a/plugins/newsdownloader.koplugin/main.lua b/plugins/newsdownloader.koplugin/main.lua index e70706392..857b1d6e4 100644 --- a/plugins/newsdownloader.koplugin/main.lua +++ b/plugins/newsdownloader.koplugin/main.lua @@ -614,6 +614,24 @@ function NewsDownloader:createFromDescription(feed, title, content, feed_output_ logger.dbg("NewsDownloader: News file will be stored to :", news_file_path) local article_message = T(_("%1\n%2"), message, title_with_date) local footer = _("If this is only a summary, the full article can be downloaded by going to the News Downloader settings and changing 'Download full article' to 'true'.") + + local base_url = getFeedLink(feed.link) + if base_url then + if not base_url:match("/$") then + base_url = base_url .. "/" + end + content = content:gsub('href="(.-)"', function(link) + if link:match("^/") then + local base_url_domain_only = base_url:match("^(.-://[^/]+)/") + return 'href="' .. base_url_domain_only .. link .. '"' + end + if not link:match("^[a-zA-Z][a-zA-Z0-9+.-]*://") then + link = base_url .. link + end + return 'href="' .. link .. '"' + end) + end + local html = string.format([[