Fix handling of the event that a file loses its thumbnail.

In which case return_filepath is None and the relative_to breaks.
This commit is contained in:
voussoir 2018-05-01 20:41:38 -07:00
parent 1626a6fa11
commit 58d450a856

View file

@ -830,9 +830,11 @@ class Photo(ObjectBase):
return_filepath = hopeful_filepath
if return_filepath != self.thumbnail:
if return_filepath is not None:
return_filepath = return_filepath.relative_to(self.photodb.thumbnail_directory)
data = {
'id': self.id,
'thumbnail': return_filepath.relative_to(self.photodb.thumbnail_directory),
'thumbnail': return_filepath,
}
self.photodb.sql_update(table='photos', pairs=data, where_key='id')
self.thumbnail = return_filepath