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:
parent
1626a6fa11
commit
58d450a856
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue