Debug File Download

Currently running into a few issues with file downloads not working for Reviewers. Is there a simple way to debug file downloads? How can I test what file/path the system is trying to pull?

Currently, it just redirects back to the Reviewer page rather than serving the file even though I can see the file in the DB and on the File System. I’ve already checked permissions and www-data is capable of serving the file (an Editor can download the review file from the inReview page).

Andy

Hi Andy,

Are you asking about OJS or OMP? What version?

Regards,
Alec Smecher
Public Knowledge Project Team

Hey Alec

OJS, 2.4.3

Cheers

Hi @ajrbyers,

In file permission or missing file situations, you’ll typically see a blank page; a redirect more likely suggests that part of the OJS code is specifically denying access. However, I’d start by making a test copy of the newest release, running an upgrade, and seeing if that resolves the problem. Reviewer file access is pretty important, and I suspect we’d be hearing more if it didn’t work in the newest OJS.

To debug the download code itself, have a look in FileManager::downloadFile. But if it’s a level above that in the OJS code that’s causing the redirect, as I suspect, then you’ll never see that function called.

Regards,
Alec Smecher
Public Knowledge Project Team

Do you have any idea where the permission decision is being made? It doesn’t make sense to me, the RV files look right in the DB…

Andy

Hi @ajrbyers,

There are some quick hints on where to start finding handling code in the OJS technical reference that start with the request URL. I’d suggest starting there – but I do wonder whether you’ll find that it’s an old/already fixed issue.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec,

I’m afraid I need to fix this rather than upgrade at the moment. I’ve tracked the permissions down to this line:

if ((!$reviewAssignment->getDateConfirmed() || $reviewAssignment->getDeclined()) && $journal->getSetting('restrictReviewerFileAccess')) {
            // Restrict files until review is accepted
        } else if ($reviewAssignment->getReviewFileId() == $fileId) {
            if ($revision != null) {
                $canDownload = ($reviewAssignment->getReviewRevision() == $revision);
                var_dump($reviewAssignment->getReviewRevision() == $revision);
            }
        } else if ($reviewAssignment->getReviewerFileId() == $fileId) {
            $canDownload = true;
        } else {
            foreach ($reviewAssignment->getSuppFiles() as $suppFile) {
                if ($suppFile->getFileId() == $fileId && $suppFile->getShowReviewers()) {
                    $canDownload = true;
                }
            }
        }

This line:

var_dump($reviewAssignment->getReviewRevision() == $revision);

Returns a false boolean. $revision is 1 but getReviewRevision is Null. It uses some obscure getData function, any ideas what field it’s trying to retreive from the DB so I can check if something has gone wrong there?

Andy

Worked it out, the Review Rounds table was locked and wouldn’t let new ones be created. Fixed :smile: