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.
This commit is contained in:
Robert Miles 2023-03-17 08:00:41 +00:00
parent 302d352da4
commit dbfac1ace5
1 changed files with 1 additions and 1 deletions

2
app.py
View File

@ -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):