Only accept HTML `<link rel="alternate">` on success

This commit is contained in:
Julia Johannesen 2024-09-22 17:13:24 -04:00
parent bc02b4ae1f
commit 6ea48be84a
No known key found for this signature in database
GPG Key ID: 4A1377AF3E7FBC46
1 changed files with 6 additions and 1 deletions

View File

@ -207,7 +207,12 @@ 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 === true) { if (
res.status >= 200
&& res.status <= 299
&& (contentType ?? '').split(';')[0].trimEnd().toLowerCase() === 'text/html'
&& _followAlternate === true
) {
const html = await res.text(); const html = await res.text();
const window = new Window({ const window = new Window({
settings: { settings: {