From: zancas <zancas@leastauthority.com>
Date: Fri, 10 Oct 2014 02:37:32 +0000 (-0600)
Subject: Do not report 'size' metadata if get_size returns None
X-Git-Tag: allmydata-tahoe-1.10.1a1~114^2
X-Git-Url: https://git.rkrishnan.org/vdrive/%22news.html?a=commitdiff_plain;h=refs%2Fpull%2F120%2Fhead;p=tahoe-lafs%2Ftahoe-lafs.git

Do not report 'size' metadata if get_size returns None
---

diff --git a/src/allmydata/web/common.py b/src/allmydata/web/common.py
index 2d15281c..2c873206 100644
--- a/src/allmydata/web/common.py
+++ b/src/allmydata/web/common.py
@@ -19,8 +19,7 @@ from allmydata.util.encodingutil import to_str, quote_output
 TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
 
 def get_filenode_metadata(filenode):
-    metadata = {'size': filenode.get_size(),
-                'mutable': filenode.is_mutable()}
+    metadata = {'mutable': filenode.is_mutable()}
     if metadata['mutable']:
         mutable_type = filenode.get_version()
         assert mutable_type in (SDMF_VERSION, MDMF_VERSION)
@@ -31,6 +30,8 @@ def get_filenode_metadata(filenode):
     else:
         file_format = "CHK"
     metadata['format'] = file_format
+    if filenode.get_size() is not None:
+        metadata['size'] = filenode.get_size()
     return metadata
 
 class IOpHandleTable(Interface):