mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Ensure filling in "none" when a tag has not been found
This commit is contained in:
		| @@ -326,6 +326,8 @@ class Document(models.Model): | ||||
|     def generate_source_filename(self): | ||||
|         # Create filename based on configured format | ||||
|         if settings.PAPERLESS_FILENAME_FORMAT is not None: | ||||
|             tag = defaultdict(lambda: slugify(None), | ||||
|                               self.many_to_dictionary(self.tags)) | ||||
|             list_length = 10 | ||||
|             tags = self.many_to_list(self.tags) | ||||
|             while True: | ||||
| @@ -336,7 +338,7 @@ class Document(models.Model): | ||||
|                            title=slugify(self.title), | ||||
|                            created=slugify(self.created), | ||||
|                            added=slugify(self.added), | ||||
|                            tag=defaultdict(str, self.many_to_dictionary(self.tags)), | ||||
|                            tag=tag, | ||||
|                            tags=tags) | ||||
|                     break | ||||
|                 except IndexError: | ||||
|   | ||||
| @@ -206,7 +206,7 @@ class TestDate(TestCase): | ||||
|         # Ensure that filename is properly generated | ||||
|         tmp = document.source_filename | ||||
|         self.assertEqual(document.generate_source_filename(), | ||||
|                          "0000001.pdf") | ||||
|                          "none-0000001.pdf") | ||||
|         document.create_source_directory() | ||||
|         Path(document.source_path).touch() | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Wolf-Bastian Poettner
					Wolf-Bastian Poettner