stable

Clone or download

Read-only

fix: delete version should not delete the last version

Documentation of REST route `DELETE docman_file_versions/:id` says that we cannot delete the last version of an item, but nothing prevent that if we call the REST route directly, and we end up with a corrupted item. This contribution adds the necessary check and change the return status code to 204 since we do not return any content. Part of story #28263: edit office document stored in Document Change-Id: I9311d65c4e561f99d973a4615e7ff1030d0b41db

Modified Files

Name
M plugins/docman/include/REST/v1/Files/FileVersionsDeletor.php +13 −3 Go to diff View file
M plugins/docman/include/REST/v1/Files/FileVersionsResource.php +6 −2 Go to diff View file
A plugins/docman/include/Version/ICountVersions.php +28 −0 Go to diff View file
M plugins/docman/include/Version/VersionDao.php +1 −1 Go to diff View file
M plugins/docman/tests/unit/REST/v1/Files/FileVersionsDeletorTest.php +49 −0 Go to diff View file
A plugins/docman/tests/unit/Stubs/ICountVersionsStub.php +47 −0 Go to diff View file