From dbfac1ace574ce7ad68b91ddf45977bead536359 Mon Sep 17 00:00:00 2001 From: khuxkm fbexl Date: Fri, 17 Mar 2023 08:00:41 +0000 Subject: [PATCH] Replace hacky 'call-out-to-shell' with an actual API call Might possibly have a shot at, if nothing else, helping us get a little closer to finding the cause of #2. --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index c77279f..1578d8c 100644 --- a/app.py +++ b/app.py @@ -183,7 +183,7 @@ def ship(request,ship=None): author = f.readline().strip() yield f"=> /{urlencoded}/AUTHOR © {year} {author}\n" else: - username = (subprocess.run(["/usr/bin/stat","-c","%U",os.path.join("/var/gopher",ship_unquoted)],stdout=subprocess.PIPE).stdout or b"unknown").decode("utf-8").strip() + username = (Path("/var/gopher") / ship_unquoted).owner() yield f"© {year} {username}\n" license_file = os.path.join("/var/gopher",ship_unquoted,"LICENSE") if os.path.exists(license_file):