From 302ec0b7646d7b7a2ed6897b8156268075c0a43b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Wed, 27 Sep 2023 23:35:20 +0200 Subject: [PATCH] [autoserve] Return 404 when appropriate. --- scripts/autoserve.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/autoserve.py b/scripts/autoserve.py index 824a26c..ab6f149 100644 --- a/scripts/autoserve.py +++ b/scripts/autoserve.py @@ -70,6 +70,11 @@ class Server(http.server.SimpleHTTPRequestHandler): self.end_headers() return + if not os.path.exists(path.strip('/')): + self.send_response(404) + self.end_headers() + return + # send 200 response self.send_response(200) # send response headers