Make use of relpath instead of basepath

This commit is contained in:
Johannes M. Scheuermann 2022-05-07 09:26:00 +01:00
parent 4804bb21cf
commit b53c9fe851

View File

@ -519,13 +519,13 @@ class Server(BaseHTTPRequestHandler):
if self.path.startswith("/check_hash/"):
try:
self.send_text(
check_hash(os.path.basename(self.path)), add_newline=False
check_hash(os.path.relpath(self.path, "/check_hash")), add_newline=False
)
except FileNotFoundError:
self.send_error(404, "Path not found")
self.end_headers()
if self.path.startswith("/is_present/"):
if is_present(os.path.basename(self.path)):
if is_present(os.path.relpath(self.path, "/is_present")):
self.send_text("OK")
else:
self.send_error(404, "Path not found")