Fix crash while trying to get size of deleted file.

Pathclass no longer returns None for missing files, as it did when
this was written.
This commit is contained in:
voussoir 2020-08-28 17:32:53 -07:00
parent 8163f33ba3
commit 45d8809971

View file

@ -893,15 +893,22 @@ class Photo(ObjectBase):
'''
self.photodb.log.debug('Reloading metadata for %s', self)
# If the file has disappeared, this will just return None.
self.bytes = self.real_path.size
self.bytes = None
self.width = None
self.height = None
self.area = None
self.ratio = None
self.duration = None
if self.simple_mimetype == 'image':
try:
self.bytes = self.real_path.size
except pathclass.NotExists:
pass
if self.bytes is None:
pass
elif self.simple_mimetype == 'image':
try:
image = PIL.Image.open(self.real_path.absolute_path)
except (OSError, ValueError):