fix(backend): /fetch-rss側でURLをデコードするように
This commit is contained in:
parent
69e662cd07
commit
1176a15bf5
|
|
@ -283,7 +283,6 @@ export class HttpRequestService {
|
|||
},
|
||||
): Promise<Response> {
|
||||
const timeout = args.timeout ?? 5000;
|
||||
const decodedUrl = decodeURIComponent(url);
|
||||
|
||||
const controller = new AbortController();
|
||||
setTimeout(() => {
|
||||
|
|
@ -292,7 +291,7 @@ export class HttpRequestService {
|
|||
|
||||
const isLocalAddressAllowed = args.isLocalAddressAllowed ?? false;
|
||||
|
||||
const res = await fetch(decodedUrl, {
|
||||
const res = await fetch(url, {
|
||||
method: args.method ?? 'GET',
|
||||
headers: {
|
||||
'User-Agent': this.config.userAgent,
|
||||
|
|
@ -300,7 +299,7 @@ export class HttpRequestService {
|
|||
},
|
||||
body: args.body,
|
||||
size: args.size ?? 10 * 1024 * 1024,
|
||||
agent: (decodedUrl) => this.getAgentByUrl(decodedUrl, false, isLocalAddressAllowed),
|
||||
agent: (url) => this.getAgentByUrl(url, false, isLocalAddressAllowed),
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ 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();
|
||||
|
||||
|
|
@ -220,7 +219,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // 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, */*',
|
||||
|
|
|
|||
Loading…
Reference in New Issue