mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Don't explode on invalid dates
This commit is contained in:
		| @@ -394,7 +394,10 @@ class FileInfo(object): | ||||
|  | ||||
|     @classmethod | ||||
|     def _get_created(cls, created): | ||||
|         try: | ||||
|             return dateutil.parser.parse("{:0<14}Z".format(created[:-1])) | ||||
|         except ValueError: | ||||
|             return None | ||||
|  | ||||
|     @classmethod | ||||
|     def _get_correspondent(cls, name): | ||||
|   | ||||
| @@ -359,3 +359,8 @@ class TestFieldPermutations(TestCase): | ||||
|                         } | ||||
|                         self._test_guessed_attributes( | ||||
|                             template.format(**spec), **spec) | ||||
|  | ||||
|     def test_invalid_date_format(self): | ||||
|         info = FileInfo.from_path("/path/to/06112017Z - title.pdf") | ||||
|         self.assertEqual(info.title, "title") | ||||
|         self.assertIsNone(info.created) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Daniel Quinn
					Daniel Quinn