Commit 3fead250 authored by Peter Palfrader's avatar Peter Palfrader

The FileApp we inherit from nowadays does not expose ENOENT and EACCES...

The FileApp we inherit from nowadays does not expose ENOENT and EACCES directly, so we check file permissions before and raise accordingly
parent 1eb8e5db
......@@ -49,6 +49,11 @@ expires_file = datetime.timedelta(seconds = int(config['app_conf']['expires.arch
class SnapshotFileApp(FileApp):
def __init__(self, path, digest, filename=None):
if not os.path.exists(path):
raise OSError(errno.ENOENT, 'No such file or directory', path)
if not os.access(path, os.R_OK):
raise IOError(errno.EACCES, 'Cannot read', path)
h = {}
if not filename is None:
(type, encoding) = mimetypes.guess_type(filename)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment