A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
fixes #91
jonaswinklerdefa80d05ac2
diff --git a/src/documents/serialisers.py b/src/documents/serialisers.pyindex 600645061..db0e610d1 100644--- a/src/documents/serialisers.py+++ b/src/documents/serialisers.py@@ -1,6 +1,5 @@import magicfrom django.utils.text import slugify-from pathvalidate import validate_filename, ValidationErrorfrom rest_framework import serializersfrom rest_framework.fields import SerializerMethodField@@ -179,12 +178,6 @@ class PostDocumentSerializer(serializers.Serializer):)def validate_document(self, document):-- try:- validate_filename(document.name)- except ValidationError:- raise serializers.ValidationError("Invalid filename.")-document_data = document.file.read()mime_type = magic.from_buffer(document_data, mime=True)diff --git a/src/documents/tests/test_api.py b/src/documents/tests/test_api.pyindex 572667406..ab1716366 100644--- a/src/documents/tests/test_api.py+++ b/src/documents/tests/test_api.py@@ -403,16 +403,6 @@ class TestDocumentApi(DirectoriesMixin, APITestCase):self.assertEqual(response.status_code, 400)m.assert_not_called()- @mock.patch("documents.views.async_task")- @mock.patch("documents.serialisers.validate_filename")- def test_upload_invalid_filename(self, validate_filename, async_task):- validate_filename.side_effect = ValidationError()- with open(os.path.join(os.path.dirname(__file__), "samples", "simple.pdf"), "rb") as f:- response = self.client.post("/api/documents/post_document/", {"document": f})- self.assertEqual(response.status_code, 400)-- async_task.assert_not_called()-@mock.patch("documents.views.async_task")def test_upload_with_title(self, async_task):with open(os.path.join(os.path.dirname(__file__), "samples", "simple.pdf"), "rb") as f: