From 8c411ceb70688045baecb350a2cd453a0fc9f308 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 31 Aug 2007 14:32:33 -0400 Subject: [PATCH] Return 404 error when path can't be translated --- sugar/network.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sugar/network.py b/sugar/network.py index 77de95e8..49d48826 100644 --- a/sugar/network.py +++ b/sugar/network.py @@ -144,6 +144,10 @@ class ChunkedGlibHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): ** [dcbw] modified to send Content-disposition filename too """ path = self.translate_path(self.path) + if not path or not os.path.exists(path): + self.send_error(404, "File not found") + return None + f = None if os.path.isdir(path): for index in "index.html", "index.htm":