Both add paths, the CLI's and the web's, look behind the URL first: a web page that names its feed with <link rel="alternate"> is swapped for that feed, before the duplicate check so it finds a feed someone already has. Before, the page itself was added and every scan failed on it. alternate_feed_link found tags in a to_lowercase() copy and sliced the original at those offsets; Unicode lowercasing changes some characters' length, so a page with one before its <link> tags lost the href or panicked off a char boundary. ASCII lowercasing keeps offsets aligned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1279,7 +1279,8 @@ async fn add_feed(
|
||||
Json(body): Json<NewFeed>,
|
||||
) -> Result<Json<serde_json::Value>, ApiError> {
|
||||
let mut cfg = (*state.ctx.cfg()).clone();
|
||||
let url = crate::feed::expand_input(&body.url);
|
||||
// Before the duplicate check, so a site's page finds the feed someone already has.
|
||||
let url = crate::feed::feed_behind_page(&state.ctx.client, &crate::feed::expand_input(&body.url)).await;
|
||||
// Someone else may already have it. Then adding costs nothing: no second fetch, no
|
||||
// second copy on disk, just another name against the same feed.
|
||||
if let Some(existing) = crate::subscriptions(&state.ctx).await?
|
||||
|
||||
Reference in New Issue
Block a user