OJS Journal is having an issue with uploading documents

The file FileUploadWizardHandler.inc.php is the same on both version.

Hi @Vitaliy

I first found these four differences in these 2 attached files, can you give your thoughts on it? meanwhile I will continue looking for other changes.

image

https://uofc-my.sharepoint.com/:u:/g/personal/dule_ucalgary_ca/EeF6OZIyrldNmjWDlKqDD-4BJQZO-ri7chQJceoqXSLRlA?e=IPpXCw

Please see attachments above.

Thank you!

Dung.

Or should I better start with your debugging instruction?
Thanks so much for direction!
D.

Yes, changes in PKPSubmissionFileService::getWorkflowStageId also can cause the error you experience. In short, I suspect in your case because of modifications, this method returns null and, in short, this causes this access policy to fail: https://github.com/pkp/pkp-lib/blob/stable-3_3_0/controllers/wizard/fileUpload/FileUploadWizardHandler.inc.php#L101, because it cannot determine workflow stage ID here: https://github.com/pkp/pkp-lib/blob/stable-3_3_0/classes/security/authorization/internal/SubmissionFileMatchesWorkflowStageIdPolicy.inc.php#L44

Regarding those patches, I don’t see the correspondent code in the current OJS stable-3_3_0 branch. Do you remember why those were applied?
E.g., the check

if ($query->getAssocType() != ASSOC_TYPE_QUERY) {
     return null;
}

returns null, when uploading file throw the wizard in discussions because its associated type is ASSOC_TYPE_SUBMISSION and not ASSOC_TYPE_QUERY

Hi @Vitaliy and @Sarah_Adams

I found it all below and what is your thoughts on how to move forward @Vitaliy ?

The issue is " Activitiy Log fails to load when certain values are null due to insufficient error handling in lib/pkp/classes/services/PKPSubmissionFileService.inc.php "

Sarah’s internal ticket is at https://ucalgary.samanage.com/incidents/92402652-fw-activity-logs

I Followed the instructions from 2 posts, I was able to patch to resolve the bug for our version 3.3.0.8

  1. https://github.com/pkp/pkp-lib/commit/a1cf06976223d91b5ecef4ec79a951f872f658db

After applying the first patch above then went on to apply the second patch below

  1. https://github.com/pkp/pkp-lib/issues/7563

This has fixed the bug. But now introduced new bug.

In my local dev environment I have tried to reverse these exact 4 changes and that resolved the current issue.

Please let me know the best next step?

Thank you!

Dung.

1 Like

Thanks, @dung

I see, this is about the activity log loading problem. I’m able to reproduce it but looking at the code, I’m unable to suggest the solution right away. You can track the Github issue, there will be a link to the pull request which addresses the problem.

2 Likes

Good Morning @Vitaliy ,

If I can ask you one more question, Is there any work around for this that you can think of until there will be resolution or you think I can possibly play with the code and make it work in both issues? I know some php programming. (Or I will make it worse if I touch the code).

Appreciate your opinion!

Dung.

1 Like

Hi @dung,
Sorry for a late reply. Unfortunately, I don’t understand why the check

if ($query->getAssocType() != ASSOC_TYPE_QUERY) {
     return null;
}

is introduced at all. Does the activity log fail to load without it?

There is an ongoing discussion around the PR that addresses the issue with activity log, not sure if it’s going to be useful: [pkp-lib][main] #8073 Add fix for non-existing Note query. by defstat · Pull Request #8075 · pkp/pkp-lib · GitHub (in the main branch this part of code was moved to lib/pkp/classes/SubmissionFile/Repository::getWorkflowStageId())

1 Like

Hi @Vitaliy

The Activity Log fails to load without the 4 changes I mentioned in previous message where I showed screenshot and attachments of the code.

I had to revert these changes to keep the “file uploading” working because that is more important feature for us.

The Activity Log issue url you gave probably for other version of OJS because I can not find the file “class / submitFile / Repository.inc.php” in my version 3.3.0.8. So I can not make changes for a test.

Thank you so much for your time.

Best,

Dung.

1 Like