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:
		
							parent
							
								
									8163f33ba3
								
							
						
					
					
						commit
						45d8809971
					
				
					 1 changed files with 10 additions and 3 deletions
				
			
		|  | @ -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): | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue