PDF 404 error after upgrading to 3.4

Describe the issue or problem
I recently upgraded an OJS install to 3.4 (from 3.3.x). The upgrade went smoothly (no errors over the command line when running the upgrade script) but I’ve noticed that all of the PDFs for this site throw 404 errors (or Message: Missing PDF in the PDFjs viewer).
It seems like the issue is related to the query being run to find the file. I’ve confirmed that the files exist in the private files directory, that permissions are set correctly, and that the files are not corrupted.
I can’t figure out what the issue is.
Here is an example of a PDF that should be displaying but is throwing the error -
https://wwwtest.constitutionalstudies.wisc.edu/index.php/cs/article/view/90/68

What application are you using?
OJS 3.4.0

Additional information
Screen shot -

The same problem on version 3.3.0.15. I cannot solve this problem.
Error log: [Thu Sep 28 11:23:39.781461 2023] [cgi:error] [pid 10007] [client 78.137.2.34:59038] AH01215: [4,“78.137.2.34”,“Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/117.0.0.0 Safari\/537.36”,1695800186,1695889419,1,“csrf|a:2:{s:9:\“timestamp\”;i:1695889419;s:5:\“token\”;s:32:\“4ec37212c911a1cc0abac4b2e1cbc5b1\”;}userId|i:4;username|s:8:\“pa-admin\”;”,“pa.journal.in.ua”,“2ace07f917c5e0b7c6718885cf75d6d0”]: /var/www/php-bin/journal/php, referer: https://pa.journal.in.ua/index.php/pa/index

Does anyone have any solution? I would really like to upgrade my OJS version if possible.
@asmecher - any thoughts or guidance you can provide?

Hi @JOHNBENT,

I suspect you’ve probably done this, but double-check that the files_dir setting in your config.inc.php is correct.

If you’d like to debug where OJS is trying to find the file on the filesystem, have a look in the download function in lib/pkp/classes/services/PKPFileService.php. In particular, see the line:

$path = $file->path;

You might try adding an error_log call to dump this out to the PHP error log:

$path = $file->path;
error_log('ABOUT TO DOWNLOAD A FILE FROM PATH: "' . $path . '"');

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks @asmecher - That was helpful.
I was able to rerun the upgrade and get file downloads working.
I think the issue I was running into was that I had the stacktrace and error reporting options turned on after the upgrade to see any error messages and warnings.
It looks like some deprecation warnings were being outputted and that disrupted the download function in the PKPFileService class - the headers were already sent so the function could not use headers to launch the download.

Can you confirm that my assumption is accurate?

Hi @JOHNBENT,

That sounds entirely plausible. Anything that dumps information to the browser (e.g. debug / warning notices) will prevent further headers from being sent.

Regards,
Alec Smecher
Public Knowledge Project Team

This topic was automatically closed after 10 days. New replies are no longer allowed.