From ce9e34f55ee0f9bd72841b10ca44f0a76a661063 Mon Sep 17 00:00:00 2001 From: Kumi Date: Sat, 3 Aug 2024 16:39:46 +0200 Subject: [PATCH] fix(proxy): correct URL composition for CDNJS Updated the URL construction within the proxy function to correctly reference CDNJS URLs. Previously the variable name mistakenly suggested an old CDN (jsdelivr), potentially leading to confusion and incorrect URL referencing. This change ensures accuracy and consistency when fetching and streaming resources. --- app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 5a3e7c2..a59d69d 100644 --- a/app.py +++ b/app.py @@ -16,13 +16,13 @@ def home(): @app.route("/") def proxy(url): - jsdelivr_url = f"https://cdnjs.cloudflare.com/{url}" + cdnjs_url = f"https://cdnjs.cloudflare.com/{url}" def generate(): # Subfunction to allow streaming the data instead of # downloading all of it at once try: - with urlopen(unquote(url)) as data: + with urlopen(unquote(cdnjs_url)) as data: while True: chunk = data.read(1024 * 1024) if not chunk: @@ -32,7 +32,7 @@ def proxy(url): abort(e.code) try: - with urlopen(unquote(jsdelivr_url)) as data: + with urlopen(unquote(cdnjs_url)) as data: content_type = data.headers["content-type"] except HTTPError as e: abort(e.code)