-
Notifications
You must be signed in to change notification settings - Fork 530
PDF file download problem #1743
Description
Describe the bug
I'll report this as an Angular UI issue to start the discussion, but aspects of the REST API are also involved.
Currently, when the user choses to download a PDF file (and probably other file formats that can be rendered inline in the browser) the bitstream download page is opened followed by a hard redirect to the REST API content endpoint. In the case of a PDF, the REST API response Content-Disposition header usually indicates an inline resource and the PDF file is rendered in the browser window.
There are 2 problems with this.
- Two clicks in the browser navbar are required to return to the DSpace Item page; the first back click results in the PDF file being rendered again a second time.
- If the bitstream has access restrictions, the first click instead results in a WhiteLabel page indicating a 401 error.
One possible solution for #1 is to open the bitstream download page in a new browser tab. This can be done easily a themed version of file-section-component.html by adding isBlank=true to attributes of theds-download-link element. We might want to consider making this change in the default component.
Unfortunately, if bitstream access is restricted, opening the download page in a new tab also results in #2 (the 401 error ) so more work would be required to make this solution work.
There may be other, better ways to solve the navigation problem.
To Reproduce
Steps to reproduce the behavior:
- Click to download a PDF file in the simple Item view
- Once open, use the browser back button to navigate back to the item
- Try the same thing again on a bitstream with restricted access and you should see a 401 error.
Expected behavior
The download page serves a useful purpose so ideally everything would remain as is with the exception of fixing the 2-click return problem for inline files. Alternately, opening the download page in a new tab an acceptable compromise once the authorization error is fixed. There may be other solutions.
Related work
Link to any related tickets or PRs here.