...
 
Commits (2)
......@@ -158,7 +158,7 @@ note: different source packages can build binaries with the same binary package
URL: /file/<hash>
http status codes: 200 500 404 451 304
http status codes: 200 500 403 404 451 304
[return the file]
URL: /mr/file/<hash>/info
......
......@@ -76,12 +76,12 @@ def make_app(global_conf, full_stack=True, static_files=True, **app_conf):
# Handle Python exceptions
app = ErrorHandler(app, global_conf, **config['pylons.errorware'])
# Display error documents for 401, 404, 451 status codes (and
# Display error documents for 401, 403, 404, 451 status codes (and
# 500 when debug is disabled)
if asbool(config['debug']):
app = StatusCodeRedirect(app)
else:
app = StatusCodeRedirect(app, [400, 401, 404, 451, 500])
app = StatusCodeRedirect(app, [400, 401, 403, 404, 451, 500])
# Optionally suppress all Python warnings
if not 'warnings' in config or not asbool(config['warnings']):
......
......@@ -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)
......