From d8406190c7d6ff0f937eaa9ca6ff861e8f21c64e Mon Sep 17 00:00:00 2001 From: Haozhe Wu <347492564@qq.com> Date: Mon, 23 Mar 2026 13:14:40 +0800 Subject: [PATCH] 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 Co-authored-by: Elie Habib --- api/telegram-feed.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/telegram-feed.js b/api/telegram-feed.js index 72db39b71..a3396e7f4 100644 --- a/api/telegram-feed.js +++ b/api/telegram-feed.js @@ -29,8 +29,8 @@ export default async function handler(req) { const channel = (url.searchParams.get('channel') || '').trim(); const params = new URLSearchParams(); params.set('limit', String(limit)); - if (topic) params.set('topic', encodeURIComponent(topic)); - if (channel) params.set('channel', encodeURIComponent(channel)); + if (topic) params.set('topic', topic); + if (channel) params.set('channel', channel); const relayUrl = `${relayBaseUrl}/telegram/feed?${params}`; const response = await fetchWithTimeout(relayUrl, {