From: Brian Warner Date: Fri, 7 Nov 2008 05:51:17 +0000 (-0700) Subject: web/info: don't let an unrecoverable file break the page (show ? instead of a size) X-Git-Url: https://git.rkrishnan.org/pf/content/en/footer/legal.html?a=commitdiff_plain;h=68f366b5844937399248fc4fa5d6b8532d5b4da2;p=tahoe-lafs%2Ftahoe-lafs.git web/info: don't let an unrecoverable file break the page (show ? instead of a size) --- 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