From 4a8d7d70cb08976a0ba580aa734a00652067f143 Mon Sep 17 00:00:00 2001 From: Haishan Date: Sat, 23 Jul 2022 20:15:26 +0800 Subject: [PATCH] Should encode names in provider API url --- src/api/proxies.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/proxies.ts b/src/api/proxies.ts index 69100c0..c62213e 100644 --- a/src/api/proxies.ts +++ b/src/api/proxies.ts @@ -61,11 +61,11 @@ export async function fetchProviderProxies(config: ClashAPIConfig) { export async function updateProviderByName(config: ClashAPIConfig, name: string) { const { url, init } = getURLAndInit(config); const options = { ...init, method: 'PUT' }; - return await fetch(url + '/providers/proxies/' + name, options); + return await fetch(url + '/providers/proxies/' + encodeURIComponent(name), options); } export async function healthcheckProviderByName(config: ClashAPIConfig, name: string) { const { url, init } = getURLAndInit(config); const options = { ...init, method: 'GET' }; - return await fetch(url + '/providers/proxies/' + name + '/healthcheck', options); + return await fetch(url + '/providers/proxies/' + encodeURIComponent(name) + '/healthcheck', options); }