From ed5565a075fdf40783a0388e01ee2d8099ceddcc Mon Sep 17 00:00:00 2001 From: Skillet Date: Wed, 2 Aug 2023 23:29:50 -0400 Subject: [PATCH] add in backup incase of no connect --- simpleFileServer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/simpleFileServer.py b/simpleFileServer.py index 48eabd3..a70afed 100644 --- a/simpleFileServer.py +++ b/simpleFileServer.py @@ -40,9 +40,9 @@ class serveRA(http.server.SimpleHTTPRequestHandler): if response.status_code == 200: responsetext = response.text config = file.read().decode('utf-8') - confgrps = re.findall(r"^permissions/(.+)=(.+)", config, flags=re.M) - baseperm = re.match(r"^permissions=(.+)", config, flags=re.M) - responsetext = re.sub(r"^Group=(.+):(.+)", fr'Group=\1:{baseperm[0]}', responsetext, flags=re.M) + confgrps = re.findall(r"permissions/(.+)=(.+)", config, flags=re.M) + baseperm = re.findall(r"permissions=(.+)", config, flags=re.M) + responsetext = re.sub(r"Group=(.+):(.+)", fr'Group=\1:{baseperm[0]}', responsetext, flags=re.M) for congrp in confgrps: responsetext = re.sub(rf"^Group=({congrp[0]}):(.+)", rf"Group=\1:{congrp[1]}", responsetext, flags=re.M) self.wfile.write(responsetext.encode('utf-8'))