Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ class FeedParserTest : DIAware {
val feed = cornucopiaAtom.use { feedParser.parseFeedResponse(it) }.getOrNull()!!

assertEquals("http://cornucopia.cornubot.se/", feed.home_page_url)
assertEquals("https://cornucopia.cornubot.se/feeds/posts/default", feed.feed_url)
assertEquals("http://www.blogger.com/feeds/8354057230547055221/posts/default", feed.feed_url)

assertEquals(25, feed.items!!.size)
val item = feed.items!!.first()
Expand Down Expand Up @@ -844,7 +844,7 @@ class FeedParserTest : DIAware {
val feed = anon.use { feedParser.parseFeedResponse(it) }

assertEquals("http://ANON.com/sub", feed.getOrNull()!!.home_page_url)
assertEquals("http://anon.com/rss", feed.getOrNull()!!.feed_url)
assertEquals("http://ANON.com/rss", feed.getOrNull()!!.feed_url)
Comment on lines 846 to +847

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion makes the test sensitive to the exact casing of the host in feed_url ("ANON.com" vs "anon.com"), even though host casing is not semantically meaningful and may vary depending on how the URL was produced (OkHttp vs java.net.URL). To keep the test robust, consider normalizing before comparing (e.g., parse as URL and compare host.lowercase() + path, or compare via URI), rather than asserting the raw string form.

Copilot uses AI. Check for mistakes.
assertEquals("ANON", feed.getOrNull()!!.title)
assertEquals("ANON", feed.getOrNull()!!.description)

Expand Down Expand Up @@ -1212,7 +1212,7 @@ const val rssBleepingComputer = """
<generator>https://www.bleepingcomputer.com/</generator>
<language>en</language>
<atom:link href="https://www.bleepingcomputer.com/feed/" rel="self" type="application/rss+xml" />

<item>
<title>SIM swappers now stealing phone numbers from eSIMs</title>
<link>https://www.bleepingcomputer.com/news/security/sim-swappers-now-stealing-phone-numbers-from-esims/</link>
Expand Down Expand Up @@ -1308,7 +1308,7 @@ const val rssWithHtmlEscapedDescription = """
<description>Recent content in Cowboy Programmer on Cowboy Programmer</description>
<language>en-us</language>
<lastBuildDate>Sun, 01 Sep 2019 23:21:00 +0200</lastBuildDate>

<item>
<title>description</title>
<link>http://cowboyprogrammer.org/4</link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,7 @@ private fun GoFeed.asFeed(url: URL): ParsedFeed =
ParsedFeed(
title = title,
home_page_url = link?.let { relativeLinkIntoAbsolute(url, it) },
// Keep original URL to maintain authentication data and/or tokens in query params
feed_url = url.toString(),
feed_url = feedLink?.let { relativeLinkIntoAbsolute(url, it) } ?: url.toString(),

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feed_url is now derived from feedLink via relativeLinkIntoAbsolute, which can return the original (potentially invalid) feedLink string on parse failure. That makes ParsedFeed.feed_url no longer guaranteed to be a valid URL (previously it always fell back to url.toString()), and downstream code (e.g. sync storing the feed URL) may end up persisting an invalid URL. Consider validating/parsing the resolved feedLink and falling back to the request URL when it can’t be parsed (and optionally treating blank/whitespace-only feedLink as missing).

Copilot uses AI. Check for mistakes.
description = description,
user_comment = "",
next_url = "",
Expand Down