]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
web/info: don't let an unrecoverable file break the page (show ? instead of a size)
authorBrian Warner <warner@allmydata.com>
Fri, 7 Nov 2008 05:51:17 +0000 (22:51 -0700)
committerBrian Warner <warner@allmydata.com>
Fri, 7 Nov 2008 05:51:17 +0000 (22:51 -0700)
src/allmydata/web/info.py

index ff03dadf3f10a4866d071250345357152762fd8c..6d7dc3aaadde43ad6d01e5379f2f2da1ac62fcee 100644 (file)
@@ -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