# HG changeset patch # User Tero Marttila # Date 1262788886 -7200 # Node ID a6fc2c58e25b666066ef0d572181d726ddf3a272 # Parent caabf287c75ebaecad748a3eaf770d3cf646d58a return 404 for non-existant files diff -r caabf287c75e -r a6fc2c58e25b pngtile/wsgi.py --- a/pngtile/wsgi.py Wed Jan 06 16:32:00 2010 +0200 +++ b/pngtile/wsgi.py Wed Jan 06 16:41:26 2010 +0200 @@ -102,8 +102,6 @@ # build absolute path image_path = os.path.abspath(os.path.join(DATA_ROOT, image_name)) - - print image_name, image_path # ensure the path points inside the data root if not image_path.startswith(DATA_ROOT) : @@ -112,9 +110,12 @@ if os.path.isdir(image_path) : return Response(dir_view(req, image_name, image_path), content_type="text/html") + + elif not os.path.exists(image_path) : + raise exceptions.NotFound(image_name) elif not image_name or not image_name.endswith('.png') : - raise exceptions.BadRequest("no .png path given") + raise exceptions.BadRequest("Not a PNG file") # get Image object