From edc8d70db0939709d7d4eff8a18fc2e02b106859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=98=E7=80=AC=E3=81=93=E3=81=93=E3=81=82?= Date: Thu, 21 Nov 2024 15:45:31 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix(backend):=20URL=E3=82=92=E3=83=87?= =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=89=E3=81=97=E3=81=A6=E3=81=8B=E3=82=89?= =?UTF-8?q?=E3=83=AA=E3=82=AF=E3=82=A8=E3=82=B9=E3=83=88=E3=82=92=E9=80=81?= =?UTF-8?q?=E4=BF=A1=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/server/api/endpoints/fetch-rss.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/endpoints/fetch-rss.ts b/packages/backend/src/server/api/endpoints/fetch-rss.ts index ba48b0119e..ae6ad1b9dc 100644 --- a/packages/backend/src/server/api/endpoints/fetch-rss.ts +++ b/packages/backend/src/server/api/endpoints/fetch-rss.ts @@ -7,6 +7,7 @@ import Parser from 'rss-parser'; import { Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { HttpRequestService } from '@/core/HttpRequestService.js'; +import { URL } from 'url'; const rssParser = new Parser(); @@ -219,7 +220,7 @@ export default class extends Endpoint { // eslint- private httpRequestService: HttpRequestService, ) { super(meta, paramDef, async (ps, me) => { - const res = await this.httpRequestService.send(ps.url, { + const res = await this.httpRequestService.send(decodeURIComponent(ps.url), { method: 'GET', headers: { Accept: 'application/rss+xml, */*', From e9ee83fccd7944ad764063aea30e27366da5160b Mon Sep 17 00:00:00 2001 From: AmaseCocoa Date: Thu, 21 Nov 2024 22:54:31 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix(backend):=20HttpRequestService.send?= =?UTF-8?q?=E3=81=A7URL=E3=82=92=E3=83=87=E3=82=B3=E3=83=BC=E3=83=89?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=8B=E3=82=89=E3=83=AA=E3=82=AF=E3=82=A8?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=82=92=E9=80=81=E4=BF=A1=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HttpRequestService側で処理するように変更しました。意図していたものとは異なる可能性もありますが... --- packages/backend/src/core/HttpRequestService.ts | 3 ++- packages/backend/src/server/api/endpoints/fetch-rss.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/HttpRequestService.ts b/packages/backend/src/core/HttpRequestService.ts index 083153940a..0a23202381 100644 --- a/packages/backend/src/core/HttpRequestService.ts +++ b/packages/backend/src/core/HttpRequestService.ts @@ -283,6 +283,7 @@ export class HttpRequestService { }, ): Promise { const timeout = args.timeout ?? 5000; + const decodedUrl = decodeURIComponent(url); const controller = new AbortController(); setTimeout(() => { @@ -299,7 +300,7 @@ export class HttpRequestService { }, body: args.body, size: args.size ?? 10 * 1024 * 1024, - agent: (url) => this.getAgentByUrl(url, false, isLocalAddressAllowed), + agent: (decodedUrl) => this.getAgentByUrl(decodedUrl, false, isLocalAddressAllowed), signal: controller.signal, }); diff --git a/packages/backend/src/server/api/endpoints/fetch-rss.ts b/packages/backend/src/server/api/endpoints/fetch-rss.ts index ae6ad1b9dc..562092ea07 100644 --- a/packages/backend/src/server/api/endpoints/fetch-rss.ts +++ b/packages/backend/src/server/api/endpoints/fetch-rss.ts @@ -220,7 +220,7 @@ export default class extends Endpoint { // eslint- private httpRequestService: HttpRequestService, ) { super(meta, paramDef, async (ps, me) => { - const res = await this.httpRequestService.send(decodeURIComponent(ps.url), { + const res = await this.httpRequestService.send(ps.url, { method: 'GET', headers: { Accept: 'application/rss+xml, */*', From 3a2922db6f150d15c41ffa4ecdb99d11c77b10e7 Mon Sep 17 00:00:00 2001 From: AmaseCocoa Date: Thu, 21 Nov 2024 23:02:36 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix(backend):=20HttpRequestService.ts?= =?UTF-8?q?=E3=81=AE=E5=A4=89=E6=9B=B4=E6=BC=8F=E3=82=8C=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20(fetch=E6=99=82=E3=81=AB=E3=83=87=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=89=E6=B8=88=E3=81=BF=E3=81=AEurl=E3=82=92=E5=8F=82?= =?UTF-8?q?=E7=85=A7=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/core/HttpRequestService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/core/HttpRequestService.ts b/packages/backend/src/core/HttpRequestService.ts index 0a23202381..7e52b80cb0 100644 --- a/packages/backend/src/core/HttpRequestService.ts +++ b/packages/backend/src/core/HttpRequestService.ts @@ -292,7 +292,7 @@ export class HttpRequestService { const isLocalAddressAllowed = args.isLocalAddressAllowed ?? false; - const res = await fetch(url, { + const res = await fetch(decodedUrl, { method: args.method ?? 'GET', headers: { 'User-Agent': this.config.userAgent,