From bf8c42eecd3d645652ddd7e69b727ced2a15457d Mon Sep 17 00:00:00 2001
From: taichan <40626578+tai-cha@users.noreply.github.com>
Date: Sat, 17 Aug 2024 19:51:56 +0900
Subject: [PATCH] Fix(beckend): html content-type detection on signedGet
 (#14424)

* fix(backend): contenttype detection of html in signedGet

* code style

* fix by review
---
 packages/backend/src/core/activitypub/ApRequestService.ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/packages/backend/src/core/activitypub/ApRequestService.ts b/packages/backend/src/core/activitypub/ApRequestService.ts
index 3d1bd44648..7cf8359212 100644
--- a/packages/backend/src/core/activitypub/ApRequestService.ts
+++ b/packages/backend/src/core/activitypub/ApRequestService.ts
@@ -204,8 +204,8 @@ export class ApRequestService {
 
 		//#region リクエスト先がhtmlかつactivity+jsonへのalternate linkタグがあるとき
 		const contentType = res.headers.get('content-type');
-		
-		if ((contentType === 'text/html' || contentType?.startsWith('text/html;')) && _followAlternate === true) {
+
+		if ((contentType ?? '').split(';')[0].trimEnd().toLowerCase() === 'text/html' && _followAlternate === true) {
 			const html = await res.text();
 			const window = new Window();
 			const document = window.document;