mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
add migration to fix null characters in document contents
This commit is contained in:
15
src/documents/tests/test_migration_remove_null_characters.py
Normal file
15
src/documents/tests/test_migration_remove_null_characters.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from documents.tests.utils import DirectoriesMixin, TestMigrations
|
||||
|
||||
|
||||
class TestMigrateNullCharacters(DirectoriesMixin, TestMigrations):
|
||||
|
||||
migrate_from = '1014_auto_20210228_1614'
|
||||
migrate_to = '1015_remove_null_characters'
|
||||
|
||||
def setUpBeforeMigration(self, apps):
|
||||
Document = apps.get_model("documents", "Document")
|
||||
self.doc = Document.objects.create(content="aaa\0bbb")
|
||||
|
||||
def testMimeTypesMigrated(self):
|
||||
Document = self.apps.get_model('documents', 'Document')
|
||||
self.assertNotIn("\0", Document.objects.get(id=self.doc.id).content)
|
Reference in New Issue
Block a user