diff --git a/src/documents/serialisers.py b/src/documents/serialisers.py index 0a10b47fe..6c28f720b 100644 --- a/src/documents/serialisers.py +++ b/src/documents/serialisers.py @@ -414,7 +414,7 @@ class DocumentSerializer(OwnedObjectSerializer, DynamicFieldsModelSerializer): ) def get_original_file_name(self, obj): - return obj.get_public_filename() + return obj.original_filename def get_archived_file_name(self, obj): if obj.has_archive_version: diff --git a/src/documents/tests/test_api.py b/src/documents/tests/test_api.py index 2e8e96207..6f0fc0bbc 100644 --- a/src/documents/tests/test_api.py +++ b/src/documents/tests/test_api.py @@ -579,6 +579,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase): content="things i paid for in september", pk=3, checksum="C", + original_filename="someepdf.pdf", ) with AsyncWriter(index.open_index()) as writer: # Note to future self: there is a reason we dont use a model signal handler to update the index: some operations edit many documents at once @@ -598,6 +599,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase): self.assertEqual(response.data["count"], 1) self.assertEqual(len(results), 1) self.assertCountEqual(response.data["all"], [d3.id]) + self.assertEqual(results[0]["original_file_name"], "someepdf.pdf") response = self.client.get("/api/documents/?query=statement") results = response.data["results"]