Reviewer unable to download file (OJS

Some of the reviewer unable to download the file. If he was clicking to download then page not responding. 500 error was showing.

We have checked error log bellow mentioned error log was generated:-

[22-Jun-2022 16:44:07 Asia/Kolkata] PHP Fatal error: Uncaught Error: Call to a member function getLocalizedName() on null in /EPUB/ojs/lib/pkp/controllers/api/file/
Stack trace:
#0 /EPUB/ojs/lib/pkp/classes/core/ FileApiHandler->downloadFile()
#1 /EPUB/ojs/lib/pkp/classes/core/ PKPRouter->_authorizeInitializeAndCallRequest()
#2 /EPUB/ojs/lib/pkp/classes/core/ PKPComponentRouter->route()
#3 /EPUB/ojs/lib/pkp/classes/core/ Dispatcher->dispatch()
#4 /EPUB/ojs/index.php(68): PKPApplication->execute()
#5 {main}
thrown in /EPUB/ojs/lib/pkp/controllers/api/file/ on line 109

Hi @shantanusingh,

I suspect you’ve deleted a “genre” (also named “component” in the user interface) and that has affected any associated files. Try the following database query:

SELECT sf.genre_id FROM submission_files sf
LEFT JOIN genres g ON (sf.genre_id = g.genre_id)
WHERE g.genre_id IS NULL AND sf.genre_id IS NOT NULL;

If you get any results, you’ll need to correct the entries in submission_files that use the genre_id from the query results so that they point to an existing entry in genres.

If that is not the cause, then check this issue for a patch that may resolve it:

Alec Smecher
Public Knowledge Project Team