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

Command icon 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

kriboogh created an issue. See original summary.

mstrelan’s picture

Status: Active » Postponed (maintainer needs more info)

Thanks for reporting the issue. There is a file_exists check in PDFPreviewGenerator ::deletePDFPreview already, is this not working? What does the log message say?

kriboogh’s picture

Ah, 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 ?

mstrelan’s picture

Status: Postponed (maintainer needs more info) » Needs review
Parent issue: » #3453559: Roadmap for PDFPreview 2.0

8.x-1.2 is out and includes the fix mentioned in #3.

lysenko made their first commit to this issue’s fork.

lysenko’s picture

I 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()