From 68f366b5844937399248fc4fa5d6b8532d5b4da2 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 6 Nov 2008 22:51:17 -0700 Subject: [PATCH] web/info: don't let an unrecoverable file break the page (show ? instead of a size) --- src/allmydata/web/info.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/allmydata/web/info.py b/src/allmydata/web/info.py index ff03dadf..6d7dc3aa 100644 --- a/src/allmydata/web/info.py +++ b/src/allmydata/web/info.py @@ -8,6 +8,7 @@ from nevow.inevow import IRequest from allmydata.util import base32 from allmydata.interfaces import IDirectoryNode from allmydata.web.common import getxmlfile +from allmydata.mutable.common import UnrecoverableFileError # TODO: move class MoreInfo(rend.Page): addSlash = False @@ -59,6 +60,10 @@ class MoreInfo(rend.Page): else: # for immutable files and LIT files, we get the size from the URI d = defer.succeed(node.get_size()) + def _handle_unrecoverable(f): + f.trap(UnrecoverableFileError) + return "?" + d.addErrback(_handle_unrecoverable) d.addCallback(lambda size: ctx.tag[size]) return d -- 2.45.2