fix: encode URI for latencyTestUrl

fixes #699
Illegal url splicing may lead to misjudgment of ad block,
This commit is contained in:
啊o额iu鱼 2022-05-26 11:07:16 +08:00 committed by GitHub
parent 7c023029cb
commit d0787a640d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,7 +36,7 @@ export async function requestDelayForProxy(
latencyTestUrl = 'http://www.gstatic.com/generate_204'
) {
const { url, init } = getURLAndInit(apiConfig);
const qs = `timeout=5000&url=${latencyTestUrl}`;
const qs = `timeout=5000&url=${encodeURIComponent(latencyTestUrl)}`;
const fullURL = `${url}${endpoint}/${encodeURIComponent(name)}/delay?${qs}`;
return await fetch(fullURL, init);
}