From e9a325f774983fd47ffcde521ceb588feac8e304 Mon Sep 17 00:00:00 2001 From: Saimonokuma <234579840+Saimonokuma@users.noreply.github.com> Date: Mon, 4 May 2026 16:11:14 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=20fix:=20prevent=20IndexError=20Do?= =?UTF-8?q?S=20in=20get=5Fdatanodes=5Flink?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds a safety check to ensure that the URL path contains the expected number of segments before attempting to access them. Previously, a malformed URL or a root URL (e.g., https://datanodes.to) would cause an unhandled IndexError, leading to a Denial of Service for the script. The function now returns None if the path is invalid, which is correctly handled by the calling function. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.py b/main.py index ffb5def..a9b425d 100644 --- a/main.py +++ b/main.py @@ -39,6 +39,8 @@ async def get_fuckingfast_link(session, download_url): async def get_datanodes_link(session, download_url): parsed_url = urlparse(download_url) path_segments = parsed_url.path.split("/") + if len(path_segments) < 2 or not path_segments[1]: + return None file_code = path_segments[1].encode("latin-1", "ignore").decode("latin-1") file_name = path_segments[-1].encode("latin-1", "ignore").decode("latin-1") headers = {