From ead7afed1ade3322b25e83718d6ff651a322bf99 Mon Sep 17 00:00:00 2001 From: Xi Xu Date: Mon, 8 Dec 2025 20:05:05 +0800 Subject: [PATCH] Potential fix for code scanning alert no. 11: Incomplete regular expression for hostnames Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index b4c877b..7ec9f85 100644 --- a/src/index.js +++ b/src/index.js @@ -1245,7 +1245,7 @@ async function handleRequest(request, env, ctx) { // Rewrite URLs in the response body to go through the Cloudflare Workers // files.pythonhosted.org URLs should be rewritten to go through our pypi/files endpoint const rewrittenText = originalText.replace( - /https:\/\/files.pythonhosted.org/g, + /https:\/\/files\.pythonhosted\.org/g, `${url.origin}/pypi/files` ); responseBody = new ReadableStream({