From dd124a8aedb34a1112405fa68bd5daaa96fdc882 Mon Sep 17 00:00:00 2001
From: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
Date: Wed, 25 Sep 2024 12:31:37 +0900
Subject: Fix: ``を追って照会するのはOKレスポンスが返却された場合のみに
(#14627)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Only accept HTML `` on success
(cherry picked from commit 6ea48be84abdab66301a957c27dd5d84886dfb36)
* Use `res.ok` instead of 200-299
(cherry picked from commit b667a68bd4eb916084658592d2942d521950005b)
* jsdomに戻す
* Update Changelog
* Revert "jsdomに戻す"
This reverts commit c03603611b74d16df52e77e44c558e958a82f3f4.
* :art:
---------
Co-authored-by: Julia Johannesen
---
packages/backend/src/core/activitypub/ApRequestService.ts | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
(limited to 'packages/backend/src')
diff --git a/packages/backend/src/core/activitypub/ApRequestService.ts b/packages/backend/src/core/activitypub/ApRequestService.ts
index 7c78f3319b..c7d19adfd5 100644
--- a/packages/backend/src/core/activitypub/ApRequestService.ts
+++ b/packages/backend/src/core/activitypub/ApRequestService.ts
@@ -205,7 +205,11 @@ export class ApRequestService {
//#region リクエスト先がhtmlかつactivity+jsonへのalternate linkタグがあるとき
const contentType = res.headers.get('content-type');
- if ((contentType ?? '').split(';')[0].trimEnd().toLowerCase() === 'text/html' && _followAlternate === true) {
+ if (
+ res.ok &&
+ (contentType ?? '').split(';')[0].trimEnd().toLowerCase() === 'text/html' &&
+ _followAlternate === true
+ ) {
const html = await res.text();
const { window, happyDOM } = new Window({
settings: {
--
cgit v1.2.3-freya