Skip to content

Commit

Permalink
Only accept HTML <link rel="alternate"> on success
Browse files Browse the repository at this point in the history
  • Loading branch information
K4rakara committed Sep 22, 2024
1 parent bc02b4a commit 6ea48be
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/backend/src/core/activitypub/ApRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ 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.status >= 200
&& res.status <= 299
&& (contentType ?? '').split(';')[0].trimEnd().toLowerCase() === 'text/html'
&& _followAlternate === true
) {
const html = await res.text();
const window = new Window({
settings: {
Expand Down

0 comments on commit 6ea48be

Please sign in to comment.