From 89e5d35768235b0e0749417d76390c344419d9fe Mon Sep 17 00:00:00 2001 From: Victorious Children Studios Date: Wed, 20 Dec 2023 15:56:09 +0200 Subject: [PATCH] Made an option to specify original project folder name for link data. --- network/http_server.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/network/http_server.py b/network/http_server.py index 6794e6c..1e44301 100644 --- a/network/http_server.py +++ b/network/http_server.py @@ -80,6 +80,12 @@ except: print("Please specify a port number and then project folder.") exit() +try: + ORIGINAL_PROJECT = sys.argv[3] +except: + print("Orignal Project Name Was Not Specified.") + ORIGINAL_PROJECT = " not a folder that can exist " + def fileinfo(filename): fd = {} @@ -171,8 +177,16 @@ class handler(BaseHTTPRequestHandler): parsed = [] for i in linked: - if i.startswith(PROJECT): + + # This is a little weird, sometimes the files have the full URL + # to the data. + + if i.startswith(PROJECT): # This is good when the server is on the same machine as the orignal project parsed.append(i[len(PROJECT):]) + + elif i.startswith(ORIGINAL_PROJECT): # This is when the server is a mirror + parsed.append(i[len(ORIGINAL_PROJECT):]) + else: backward = i.count("/..") foldername = filename[:filename.rfind("/")]