Bug in on_file_version_approve event?
Permalink
I am trying to check all files during the upload process to see if they are PDF documents, and if so, to ensure they are not "scanned" PDFs but rather documents that contain readable text (for accessibility purposes). I was able to get the PDFParser library installed using composer, and I have the PDF check working with the "on_file_add" event, but I'm having trouble with the other file events.
If you upload a file "from scratch", the "on_file_add" event triggers. If you replace an existing file with a newer version, I would suspect the "on_file_version_add" event to trigger, but this doesn't appear to be the case. The only event that seems to be triggering when you replace a file with a new version is the "on_file_version_approve" event. Very strange.
If I capture the FileVersion variable from this event and dump out getFileVersionObject the properties seem to be for the existing file, not the version that was just uploaded. In fact, if I get the original File object and dump out all the versions, none of them are the new file that was uploaded.
I'm suspecting no one else has experienced this issue, but from what I have gathered there seems to be some type of bug with the on_file_version_approve event, where the File object hasn't been updated yet with the new version, and therefore the FileVersionObject contains existing properties rather than the new properties.
Anyone have any insight?
If you upload a file "from scratch", the "on_file_add" event triggers. If you replace an existing file with a newer version, I would suspect the "on_file_version_add" event to trigger, but this doesn't appear to be the case. The only event that seems to be triggering when you replace a file with a new version is the "on_file_version_approve" event. Very strange.
If I capture the FileVersion variable from this event and dump out getFileVersionObject the properties seem to be for the existing file, not the version that was just uploaded. In fact, if I get the original File object and dump out all the versions, none of them are the new file that was uploaded.
I'm suspecting no one else has experienced this issue, but from what I have gathered there seems to be some type of bug with the on_file_version_approve event, where the File object hasn't been updated yet with the new version, and therefore the FileVersionObject contains existing properties rather than the new properties.
Anyone have any insight?