open-zaak / open-zaak

Open Zaak is a modern, open-source data- and services-layer to enable zaakgericht werken, a Dutch approach to case management.
Other
38 stars 37 forks source link

Filtering Documents by version (CMIS enabled) #795

Open SilviaAmAm opened 3 years ago

SilviaAmAm commented 3 years ago

Describe the bug When multiple versions of a document exist, trying to download a previous version gives a 404 error.

To Reproduce

Adding the lines to this test:

    def test_eio_download_content_filter_by_version(self):
        eio = EnkelvoudigInformatieObjectFactory.create(
            beschrijving="beschrijving1", inhoud__data=b"inhoud1"
        )

        eio_url = reverse(
            "enkelvoudiginformatieobject-detail", kwargs={"uuid": eio.uuid}
        )
        lock = self.client.post(f"{eio_url}/lock").data["lock"]
        self.client.patch(
            eio_url,
            {
                "inhoud": b64encode(b"inhoud2"),
                "beschrijving": "beschrijving2",
                "lock": lock,
            },
        )

        self.client.post(f"{eio_url}/unlock", {"lock": lock})  # <========= *NEW LINE*

        response = self.client.get(eio_url, {"versie": "1"})
        self.assertEqual(response.status_code, status.HTTP_200_OK)

        response_download = self.client.get(response.data["inhoud"])

        self.assertTrue(response_download.streaming)
        self.assertEqual(response_download.getvalue(), b"inhoud1")

Expected behavior The earlier version of the document should be downloaded.

SilviaAmAm commented 3 years ago

In addition, if:

response = self.client.get(eio_url, {"versie": "1.0"})

is used instead of:

response = self.client.get(eio_url, {"versie": "1"})

Alfresco returns a 500 error, which then causes Open-zaak to return a 500 error.

annashamray commented 1 year ago

@SilviaAmAm Is it still the issue?