From e29cdbb79549e8a521e4639baefd6977bcc7e21e Mon Sep 17 00:00:00 2001 From: Junghoon Ban Date: Sun, 5 Jul 2026 21:48:45 +0900 Subject: [PATCH 1/3] Handle uppercase SVG favicons --- packages/cli/src/nodeinfo.test.ts | 25 +++++++++++++++++++++++++ packages/cli/src/nodeinfo.ts | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/nodeinfo.test.ts b/packages/cli/src/nodeinfo.test.ts index 0a954428a..8836d6ccf 100644 --- a/packages/cli/src/nodeinfo.test.ts +++ b/packages/cli/src/nodeinfo.test.ts @@ -81,6 +81,31 @@ test("getFaviconUrl - svg icons only falls back to /favicon.ico", async () => { fetchMock.hardReset(); }); +const HTML_WITH_UPPERCASE_SVG_ONLY = ` + + + + Test Site + + +Test + +`; + +test("getFaviconUrl - uppercase svg icons only falls back to /favicon.ico", async () => { + fetchMock.spyGlobal(); + + fetchMock.get("https://example.com/", { + body: HTML_WITH_UPPERCASE_SVG_ONLY, + headers: { "Content-Type": "text/html" }, + }); + + const result = await getFaviconUrl("https://example.com/"); + assert.equal(result.href, "https://example.com/favicon.ico"); + + fetchMock.hardReset(); +}); + const HTML_WITHOUT_ICON = ` diff --git a/packages/cli/src/nodeinfo.ts b/packages/cli/src/nodeinfo.ts index 21b4058ad..4dec5f74f 100644 --- a/packages/cli/src/nodeinfo.ts +++ b/packages/cli/src/nodeinfo.ts @@ -326,7 +326,7 @@ export async function getFaviconUrl( if (w < 38 || h < 19) continue; } if ("href" in attrs) { - if (attrs.href.endsWith(".svg")) continue; + if (attrs.href.toLowerCase().endsWith(".svg")) continue; return new URL(attrs.href, response.url); } } From 9b8c0939d4e5c7f20266c70016cde7a3573cc6b5 Mon Sep 17 00:00:00 2001 From: Junghoon Ban Date: Sun, 5 Jul 2026 22:06:41 +0900 Subject: [PATCH 2/3] Handle SVG favicon URL parameters Check the parsed favicon URL pathname before deciding whether an icon is SVG. This keeps query strings and fragments from hiding SVG favicon paths. Assisted-by: Hermes Agent:gpt-5.5 --- packages/cli/src/nodeinfo.test.ts | 25 +++++++++++++++++++++++++ packages/cli/src/nodeinfo.ts | 5 +++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/nodeinfo.test.ts b/packages/cli/src/nodeinfo.test.ts index 8836d6ccf..fa8853c55 100644 --- a/packages/cli/src/nodeinfo.test.ts +++ b/packages/cli/src/nodeinfo.test.ts @@ -106,6 +106,31 @@ test("getFaviconUrl - uppercase svg icons only falls back to /favicon.ico", asyn fetchMock.hardReset(); }); +const HTML_WITH_UPPERCASE_SVG_WITH_QUERY = ` + + + + Test Site + + +Test + +`; + +test("getFaviconUrl - uppercase svg icons with query and hash fall back to /favicon.ico", async () => { + fetchMock.spyGlobal(); + + fetchMock.get("https://example.com/", { + body: HTML_WITH_UPPERCASE_SVG_WITH_QUERY, + headers: { "Content-Type": "text/html" }, + }); + + const result = await getFaviconUrl("https://example.com/"); + assert.equal(result.href, "https://example.com/favicon.ico"); + + fetchMock.hardReset(); +}); + const HTML_WITHOUT_ICON = ` diff --git a/packages/cli/src/nodeinfo.ts b/packages/cli/src/nodeinfo.ts index 4dec5f74f..2ef9cbe63 100644 --- a/packages/cli/src/nodeinfo.ts +++ b/packages/cli/src/nodeinfo.ts @@ -326,8 +326,9 @@ export async function getFaviconUrl( if (w < 38 || h < 19) continue; } if ("href" in attrs) { - if (attrs.href.toLowerCase().endsWith(".svg")) continue; - return new URL(attrs.href, response.url); + const parsedUrl = new URL(attrs.href, response.url); + if (parsedUrl.pathname.toLowerCase().endsWith(".svg")) continue; + return parsedUrl; } } return new URL("/favicon.ico", response.url); From 33fe182563a3c65f00860e954b9aa2e044aa3612 Mon Sep 17 00:00:00 2001 From: Junghoon Ban Date: Mon, 6 Jul 2026 01:32:46 +0900 Subject: [PATCH 3/3] Document SVG favicon fallback fix Add the required changelog entry for the nodeinfo SVG favicon fallback bug fix. Assisted-by: Hermes Agent:gpt-5.5 --- CHANGES.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 4734d2c4b..1cee497c4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,17 @@ To be released. [#849]: https://github.com/fedify-dev/fedify/issues/849 [#851]: https://github.com/fedify-dev/fedify/pull/851 +### @fedify/cli + + - Fixed `fedify nodeinfo` choosing SVG favicons whose filenames use + uppercase `.SVG` extensions or include query strings or fragments. The + command now ignores those SVG favicon links and falls back to + `/favicon.ico` before rendering terminal art. [[#891], [#918] by Junghoon + Ban] + +[#891]: https://github.com/fedify-dev/fedify/issues/891 +[#918]: https://github.com/fedify-dev/fedify/pull/918 + ### @fedify/vocab - Fixed Activity Vocabulary parsing so malformed language tags in remote