From 27359ff29fe612206151a4951a96451daeda2233 Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 8 May 2023 14:19:11 -0400 Subject: [PATCH] update to include "extgrps" folder in grp name search --- simpleFileServer.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/simpleFileServer.py b/simpleFileServer.py index ef5cc9d..8c6b963 100644 --- a/simpleFileServer.py +++ b/simpleFileServer.py @@ -1,4 +1,5 @@ import http.server +import os import socketserver from urllib.parse import urlparse from urllib.parse import parse_qs @@ -15,13 +16,19 @@ class serveRA(http.server.SimpleHTTPRequestHandler): query = parse_qs(urlparse(self.path).query) if 'grpName' in query: grpName = query['grpName'][0] + grpfile = "./" + if os.path.exists(f"./wlgrps/{grpName}.cfg"): + grpfile += f"wlgrps/{grpName}.cfg" + elif os.path.exists(f"./extgrps/{grpName}.cfg"): + grpfile += f"extgrps/{grpName}.cfg" + else: + print("could not find admins file!", file=stderr) try: - file = open(f"./wlgrps/{grpName}.cfg", 'rb') + file = open(grpfile, 'rb') + self.copyfile(file, self.wfile) + file.close() except: print('failed to open file!', file=stderr) - return - self.copyfile(file, self.wfile) - file.close() return