Skip to content

Commit 8edfcea

Browse files
committed
Merge tag '1.3.21' into 1.4-maintenance
Fedify 1.3.21
2 parents 99a04c8 + edebd80 commit 8edfcea

File tree

3 files changed

+81
-1
lines changed

3 files changed

+81
-1
lines changed

CHANGES.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Version 1.4.14
88

99
To be released.
1010

11+
- Fixed a bug where ActivityPub Discovery failed to recognize XHTML
12+
self-closing `<link>` tags. The HTML/XHTML parser now correctly handles
13+
whitespace before the self-closing slash (`/>`), improving compatibility
14+
with XHTML documents that follow the self-closing tag format.
15+
1116

1217
Version 1.4.13
1318
--------------
@@ -271,6 +276,17 @@ Released on February 5, 2025.
271276
[#195]: https://github.com/fedify-dev/fedify/issues/195
272277

273278

279+
Version 1.3.21
280+
--------------
281+
282+
Released on August 25, 2025.
283+
284+
- Fixed a bug where ActivityPub Discovery failed to recognize XHTML
285+
self-closing `<link>` tags. The HTML/XHTML parser now correctly handles
286+
whitespace before the self-closing slash (`/>`), improving compatibility
287+
with XHTML documents that follow the self-closing tag format.
288+
289+
274290
Version 1.3.20
275291
--------------
276292

@@ -651,6 +667,17 @@ Released on November 30, 2024.
651667
[#193]: https://github.com/fedify-dev/fedify/issues/193
652668

653669

670+
Version 1.2.24
671+
--------------
672+
673+
Released on August 25, 2025.
674+
675+
- Fixed a bug where ActivityPub Discovery failed to recognize XHTML
676+
self-closing `<link>` tags. The HTML/XHTML parser now correctly handles
677+
whitespace before the self-closing slash (`/>`), improving compatibility
678+
with XHTML documents that follow the self-closing tag format.
679+
680+
654681
Version 1.2.23
655682
--------------
656683

@@ -1064,6 +1091,17 @@ Released on October 31, 2024.
10641091
[#118]: https://github.com/fedify-dev/fedify/issues/118
10651092

10661093

1094+
Version 1.1.24
1095+
--------------
1096+
1097+
Released on August 25, 2025.
1098+
1099+
- Fixed a bug where ActivityPub Discovery failed to recognize XHTML
1100+
self-closing `<link>` tags. The HTML/XHTML parser now correctly handles
1101+
whitespace before the self-closing slash (`/>`), improving compatibility
1102+
with XHTML documents that follow the self-closing tag format.
1103+
1104+
10671105
Version 1.1.23
10681106
--------------
10691107

@@ -1518,6 +1556,17 @@ Released on October 20, 2024.
15181556
[#150]: https://github.com/fedify-dev/fedify/issues/150
15191557

15201558

1559+
Version 1.0.27
1560+
--------------
1561+
1562+
Released on August 25, 2025.
1563+
1564+
- Fixed a bug where ActivityPub Discovery failed to recognize XHTML
1565+
self-closing `<link>` tags. The HTML/XHTML parser now correctly handles
1566+
whitespace before the self-closing slash (`/>`), improving compatibility
1567+
with XHTML documents that follow the self-closing tag format.
1568+
1569+
15211570
Version 1.0.26
15221571
--------------
15231572

src/runtime/docloader.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,36 @@ test("getDocumentLoader()", async (t) => {
215215
});
216216
});
217217

218+
mf.mock("GET@/xhtml-link", (_req) =>
219+
new Response(
220+
`<html>
221+
<head>
222+
<meta charset=utf-8>
223+
<link
224+
rel=alternate
225+
type="application/activity+json"
226+
href="https://example.com/object" />
227+
</head>
228+
</html>`,
229+
{
230+
status: 200,
231+
headers: { "Content-Type": "application/xhtml+xml; charset=utf-8" },
232+
},
233+
));
234+
235+
await t.step("XHTML <link>", async () => {
236+
assertEquals(await fetchDocumentLoader("https://example.com/xhtml-link"), {
237+
contextUrl: null,
238+
documentUrl: "https://example.com/object",
239+
document: {
240+
"@context": "https://www.w3.org/ns/activitystreams",
241+
id: "https://example.com/object",
242+
name: "Fetched object",
243+
type: "Object",
244+
},
245+
});
246+
});
247+
218248
mf.mock("GET@/html-a", (_req) =>
219249
new Response(
220250
`<html>

src/runtime/docloader.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ async function getRemoteDocument(
213213
contentType === "application/xhtml+xml" ||
214214
contentType?.startsWith("application/xhtml+xml;"))
215215
) {
216-
const p = /<(a|link)((\s+[a-z][a-z:_-]*=("[^"]*"|'[^']*'|[^\s>]+))+)\/?>/ig;
216+
const p =
217+
/<(a|link)((\s+[a-z][a-z:_-]*=("[^"]*"|'[^']*'|[^\s>]+))+)\s*\/?>/ig;
217218
const p2 = /\s+([a-z][a-z:_-]*)=("([^"]*)"|'([^']*)'|([^\s>]+))/ig;
218219
const html = await response.text();
219220
let m: RegExpExecArray | null;

0 commit comments

Comments
 (0)