mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-04-25 17:14:57 +02:00
fix(api): remove double URL-encoding in telegram-feed relay (#2108)
encodeURIComponent() is applied before URLSearchParams.set(), which already percent-encodes its value. This double-encodes special chars (e.g., space becomes %2520 instead of %20), causing relay queries with special characters in topic/channel to return wrong or empty results. Co-authored-by: warren618 <warren618@users.noreply.github.com> Co-authored-by: Elie Habib <elie.habib@gmail.com>
This commit is contained in:
@@ -29,8 +29,8 @@ export default async function handler(req) {
|
|||||||
const channel = (url.searchParams.get('channel') || '').trim();
|
const channel = (url.searchParams.get('channel') || '').trim();
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
params.set('limit', String(limit));
|
params.set('limit', String(limit));
|
||||||
if (topic) params.set('topic', encodeURIComponent(topic));
|
if (topic) params.set('topic', topic);
|
||||||
if (channel) params.set('channel', encodeURIComponent(channel));
|
if (channel) params.set('channel', channel);
|
||||||
|
|
||||||
const relayUrl = `${relayBaseUrl}/telegram/feed?${params}`;
|
const relayUrl = `${relayBaseUrl}/telegram/feed?${params}`;
|
||||||
const response = await fetchWithTimeout(relayUrl, {
|
const response = await fetchWithTimeout(relayUrl, {
|
||||||
|
|||||||
Reference in New Issue
Block a user