diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-19 23:49:25 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-19 23:49:25 -0500 |
commit | f54b007a5c9ae22b91a329925c242e23921bf974 (patch) | |
tree | aeed32a32ee530725d6c38a9e321c1dff0ff4b5f | |
parent | 3912e8c5eda18197d3d6c16b99eb927ca2308e80 (diff) | |
download | cherrypy-f54b007a5c9ae22b91a329925c242e23921bf974.tar.gz |
Also include ValueError. Fixes failing test on Python 3.5.
-rw-r--r-- | cherrypy/lib/static.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cherrypy/lib/static.py b/cherrypy/lib/static.py index a26dd4ac..6a78fc13 100644 --- a/cherrypy/lib/static.py +++ b/cherrypy/lib/static.py @@ -49,7 +49,10 @@ def serve_file(path, content_type=None, disposition=None, name=None, try: st = os.stat(path) - except (OSError, TypeError): + except (OSError, TypeError, ValueError): + # OSError when file fails to stat + # TypeError on Python 2 when there's a null byte + # ValueError on Python 3 when there's a null byte if debug: cherrypy.log('os.stat(%r) failed' % path, 'TOOLS.STATIC') raise cherrypy.NotFound() |