Fix: <link rel="alternate">を追って照会するのはOKレスポンスが返却された場合のみに (#14627)

cherry picked from commit dd124a8aed

Co-authored-by: Julia Johannesen <julia@insertdomain.name>
Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
This commit is contained in:
あわわわとーにゅ 2024-12-25 03:45:35 +09:00
parent c441c4728f
commit f5c0430bc9
No known key found for this signature in database
GPG key ID: 6AFBBF529601C1DB

View file

@ -204,7 +204,11 @@ export class ApRequestService {
//#region リクエスト先がhtmlかつactivity+jsonへのalternate linkタグがあるとき //#region リクエスト先がhtmlかつactivity+jsonへのalternate linkタグがあるとき
const contentType = res.headers.get('content-type'); const contentType = res.headers.get('content-type');
if ((contentType ?? '').split(';')[0].trimEnd().toLowerCase() === 'text/html' && _followAlternate) { if (
res.ok &&
(contentType ?? '').split(';')[0].trimEnd().toLowerCase() === 'text/html' &&
_followAlternate
) {
const html = await res.text(); const html = await res.text();
try { try {
const fragment = JSDOM.fragment(html); const fragment = JSDOM.fragment(html);