mirror of
https://github.com/tips-of-mine/gestion-certificats2.git
synced 2025-06-28 08:08:43 +02:00
![google-labs-jules[bot]](/assets/img/avatar_default.png)
This commit fixes potential 404 errors when downloading certificate and private key files. Changes made: 1. **CertificateController.php**: The logic of the `download()` method has been reviewed. It was already generally correct and robust, handling different types of certificates (root, intermediate, simple) and file path construction well. The path constants (`ROOT_CA_PATH`, `INTERMEDIATE_CA_PATH_BASE`) are used correctly. 2. **app/src/Views/certificates/index.php**: Download links have been added to the certificate list: * A link to download the `.pem` certificate file is now available for each certificate. * For root certificates (`ca.cert.pem`), an additional link to download the private key (`ca.key.pem`) is displayed if you have the 'admin' role. * Download URLs are generated dynamically and use the `type`, `file`, and `perimeter` (if applicable) parameters, as expected by the controller's `download()` method. * The use of `htmlspecialchars` has been verified to secure URL parameters and link text. Indirect code testing has been performed. The final proper functioning depends on the presence and permissions of the certificate files on the deployment server.