From 86d18eb3907343f6a89cef705799a83a983b763e Mon Sep 17 00:00:00 2001 From: Julien Herr Date: Mon, 25 May 2026 17:12:08 +0200 Subject: [PATCH] docs(infra): clarify extractFeedLinks href-resolution comment --- src/infrastructure/html-processor.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/infrastructure/html-processor.ts b/src/infrastructure/html-processor.ts index 5fb420d..551fe22 100644 --- a/src/infrastructure/html-processor.ts +++ b/src/infrastructure/html-processor.ts @@ -69,11 +69,11 @@ export function extractLinks( return links; } -// Collect a newsletter's self-advertised feed declarations: -// . -// Returns raw href+type tuples; the domain decides which MIME types are feeds. -// Relative hrefs are absolutized against the sender base (best-effort); only -// http(s) URLs survive. Plain-text bodies have no → []. +// Collect a newsletter's self-advertised feed declarations from +// tags. Returns raw href+type tuples; the +// domain decides which MIME types count as a feed. Relative hrefs are +// absolutized against the sender base (best-effort); only http(s) URLs survive. +// Plain-text bodies have no → []. export function extractFeedLinks( content: string, base = "", @@ -88,6 +88,7 @@ export function extractFeedLinks( const type = (el.getAttribute("type") ?? "").trim(); const rawHref = (el.getAttribute("href") ?? "").trim(); if (!type || !rawHref) return; + // toAbsolute() skips already-absolute hrefs (returns null), so keep those as-is. const href = /^https?:\/\//i.test(rawHref) ? rawHref : (toAbsolute(rawHref, base) ?? "");