From ac08c5e84153160f8221b30854a9b7029b8c3fe2 Mon Sep 17 00:00:00 2001 From: UltraQbik Date: Fri, 23 Aug 2024 21:09:31 +0300 Subject: Update API --- src/APIv1.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/APIv1.py b/src/APIv1.py index 882a13d..c9ba2da 100644 --- a/src/APIv1.py +++ b/src/APIv1.py @@ -65,13 +65,11 @@ def api_call(client: SSLSocket, request: Request) -> Response: """ # decode API request - split_path = request.path.split("/") - api_level1 = split_path[2] - api_request = split_path[3] + split_path = request.path.split("/", maxsplit=16)[1:] # do something with it (oh god) - if api_level1 == "file": - if api_request == "random": + if len(split_path) > 1 and split_path[1] == "file": + if len(split_path) > 2 and split_path[2] == "random": # get size size_str = request.path_args.get("size", "16mib") size = decode_size(size_str) -- cgit 1.4.1