Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependent file upload fails when confirm revision is detected #6421

Closed
NateWr opened this issue Dec 4, 2020 · 4 comments
Closed

Dependent file upload fails when confirm revision is detected #6421

NateWr opened this issue Dec 4, 2020 · 4 comments
Labels
Bug:1:Low A bug that does not have a severe consequence or affects a small number of users.

Comments

@NateWr
Copy link
Contributor

NateWr commented Dec 4, 2020

Describe the bug
When uploading a dependent file that has a name similar to an existing file, the software will detect a possible duplicate and ask the user if this is a revision of an existing file.

If you select no, it is not a dependent file, and click next, the upload fails with an exception in the authorization handler.

I was only able to reproduce this with dependent files.

I suspect this is related to authorization changes made in #6257. If so, it may not effect the master branch.

To Reproduce
Steps to reproduce the behavior:

  1. Go to any submission.
  2. Upload a .html file.
  3. In the dependent files area, upload an image file.
  4. In the same dependent files area, upload the image file again.
  5. See the possible revision warning and select "This is not a revision of an existing file"
  6. See that the upload fails.

What application are you using?
OJS 3.2.1-2

Additional information
The error log:

[04-Dec-2020 12:18:20 Europe/London] PHP Fatal error:  Uncaught Error: Call to a member function getAuthorizationMessages() on null in /home/nate/Projects/pkp/ojs-stable/lib/pkp/classes/handler/PKPHandler.inc.php:171
Stack trace:
#0 /home/nate/Projects/pkp/ojs-stable/lib/pkp/classes/core/PKPRouter.inc.php(395): PKPHandler->getLastAuthorizationMessage()
#1 /home/nate/Projects/pkp/ojs-stable/lib/pkp/classes/core/PKPComponentRouter.inc.php(257): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array)
#2 /home/nate/Projects/pkp/ojs-stable/lib/pkp/classes/core/Dispatcher.inc.php(143): PKPComponentRouter->route(Object(Request))
#3 /home/nate/Projects/pkp/ojs-stable/lib/pkp/classes/core/PKPApplication.inc.php(281): Dispatcher->dispatch(Object(Request))
#4 /home/nate/Projects/pkp/ojs-stable/index.php(68): PKPApplication->execute()
#5 {main}
  thrown in /home/nate/Projects/pkp/ojs-stable/lib/pkp/classes/handler/PKPHandler.inc.php on line 171
@NateWr NateWr added the Bug:1:Low A bug that does not have a severe consequence or affects a small number of users. label Dec 4, 2020
@NateWr NateWr added this to the OJS/OMP/OPS 3.2.1-3 milestone Dec 4, 2020
NateWr added a commit to NateWr/pkp-lib that referenced this issue Jan 6, 2021
NateWr added a commit to NateWr/pkp-lib that referenced this issue Jan 6, 2021
@NateWr
Copy link
Contributor Author

NateWr commented Jan 6, 2021

This happens when a handler's authorize method returns false without adding any policies. In such cases there is no AuthorizationDecisionManager. The PRs below fix this by checking for an AuthorizationDecisionManager before trying to get the last failure message.

PRs (master):
#6534
pkp/ojs#2979

PRs (stable):
#6535
pkp/ojs#2978

@NateWr
Copy link
Contributor Author

NateWr commented Jan 6, 2021

Ugh.. I went through all this and forgot to fix the original problem: that there is an auth failure. Working on that now...

NateWr added a commit to NateWr/pkp-lib that referenced this issue Jan 6, 2021
NateWr added a commit to NateWr/pkp-lib that referenced this issue Jan 6, 2021
@NateWr
Copy link
Contributor Author

NateWr commented Jan 6, 2021

Ok, fixed the authorization problem in stable-3_2_1. It doesn't exist in the master branch because we have abandoned the revision confirmation form. I removed some dead code in master related to that.

Tests are running.

NateWr added a commit that referenced this issue Jan 7, 2021
#6421 Fix auth error when confirming revision
NateWr added a commit that referenced this issue Jan 7, 2021
#6421 Fix auth error when confirming revision
@NateWr
Copy link
Contributor Author

NateWr commented Jan 7, 2021

Merged.

@NateWr NateWr closed this as completed Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug:1:Low A bug that does not have a severe consequence or affects a small number of users.
Projects
None yet
Development

No branches or pull requests

1 participant