diff --git a/packages/backend/src/core/HttpRequestService.ts b/packages/backend/src/core/HttpRequestService.ts index 083153940a..7e52b80cb0 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(() => { @@ -291,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, @@ -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 ba48b0119e..562092ea07 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();