Relative certificate_file_directory breaks signing
Part of #3596034 (closed).
Problem/motivation
The README uses a relative path for certificate_file_directory (sites/default/files/shared/signing_certs/). With 1.x and jrglasgow/c2patool 0.5.3, every upload then fails with:
Error: Reading private key: "/tmp/c2patool-manifest-…/sites/default/files/shared/signing_certs//es256.key"
Caused by: No such file or directory (os error 2)The wrapper writes the manifest to a temp folder, and c2patool looks for the key and certificate relative to that folder. The status report still says the certificate is OK, because Drupal looks from its own root. In the upload widget you only get "Oops, something went wrong".
The kernel test uses an absolute path, so CI doesn't catch it.
Steps to reproduce
- 1.x, jrglasgow/c2patool 0.5.3, c2patool 0.28.2.
- Set
certificate_file_directoryto the path from the README. - Upload an image.
With an absolute path it works.
Proposed resolution
Turn the key and certificate paths into absolute paths (realpath()) before they go to c2patool, in the module or in the wrapper. Then existing relative configs keep working.
I only tested 1.x. 0.5.2 also wrote the manifest to a temp folder, so it probably failed there too, but I didn't check.