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
18 changes: 18 additions & 0 deletions plugins/feed-discovery/src/feed-discovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { dedupeFeeds } from "./dedupe.js";
import { discoverFeeds } from "./discovery.js";
import { parseFeedDocument } from "./feed-parsing.js";
import { renderDiscoveryOutput } from "./output/index.js";
import { WebCandidateFeedProbeProvider } from "./providers/web-feed-probe.js";
import { extractAlternateFeedLinks } from "./probe-site.js";
import { scoreFeed } from "./scoring.js";
import type { DiscoveredFeed, FeedDiscoveryProvider } from "./types.js";
Expand Down Expand Up @@ -54,6 +55,23 @@ describe("site probing helpers", () => {
await expect(assertSafeHttpUrl("http://[::ffff:192.168.1.10]/feed")).rejects.toThrow(/Blocked internal/);
await expect(assertSafeHttpUrl("file:///etc/passwd")).rejects.toThrow(/Unsupported URL protocol/);
});

it("ignores malformed configured candidate URLs", async () => {
const provider = new WebCandidateFeedProbeProvider({
cacheTtlSeconds: 60,
maxProviders: 1,
maxProbes: 1,
requestTimeoutMs: 10,
maxBodyBytes: 1024,
userAgent: "test",
opmlPaths: [],
candidateUrls: ["not-a-url|micro"],
podcastIndexApiKey: undefined,
podcastIndexApiSecret: undefined
});

await expect(provider.search({ q: "micro" })).resolves.toEqual([]);
});
});

describe("scoring, dedupe, and output", () => {
Expand Down
2 changes: 1 addition & 1 deletion plugins/feed-discovery/src/providers/web-feed-probe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function candidateUrls(query: FeedDiscoveryQuery, configured: string[]) {

for (const entry of configured) {
const [url, ...keywords] = entry.split("|").map((part) => part.trim());
if (!url) {
if (!/^https?:\/\//i.test(url)) {
continue;
}
if (keywords.length === 0 || keywords.some((keyword) => query.q.toLowerCase().includes(keyword.toLowerCase()))) {
Expand Down
Loading