Problem/Motivation
When updating or deleting file entities, this module implements hook_file_delete and hook_file_update and tries to do filesystem actions on the file being deleted or updated which fails since the preview does not exists in this case. A watchdog log is added every time this occurs. These hooks should only process the file if that file is an actual PDF.
Steps to reproduce
Create some none PDF file-entities. Modify or delete them. Check watchdog.
Proposed resolution
Add a mime-type check in the file_delete and file_update hooks.
Issue fork pdfpreview-3442522
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mstrelan commentedThanks for reporting the issue. There is a file_exists check in PDFPreviewGenerator ::deletePDFPreview already, is this not working? What does the log message say?
Comment #4
kriboogh commentedAh, yes, we are on the official release 8.x-1.1, that doesn't yet have the check you mentioned. But it is indeed the file does not exists warning.
But then again, why run code on file's that aren't PDF's anyway ?
Comment #5
mstrelan commented8.x-1.2 is out and includes the fix mentioned in #3.
Comment #9
lysenkoI have this issue on the none PDF files
For example I have remote file "youtube" and I get this error:
Warning: filesize(): stat failed for youtube://AsnGCpdYEto in Drupal\pdfpreview\PDFPreviewGenerator->updatePDFPreview()