Skip to content

Fix #5555: downloads not working from Bitstreams tab and Workspace/Wo…#5557

Open
guillermo-escire wants to merge 2 commits intoDSpace:mainfrom
guillermo-escire:feature/5555
Open

Fix #5555: downloads not working from Bitstreams tab and Workspace/Wo…#5557
guillermo-escire wants to merge 2 commits intoDSpace:mainfrom
guillermo-escire:feature/5555

Conversation

@guillermo-escire
Copy link
Copy Markdown
Contributor

References

Fixes #5555

Description

Downloads were silently hanging from the Administer → Bitstreams tab and the Workspace/Workflow area due to two issues introduced by #5132, which added the bitstreamDownloadRedirectGuard.

Instructions for Reviewers

List of changes in this PR:

  • item-edit-bitstream-bundle.component.html: Changed the download button from [href] to [routerLink]. The previous [href] caused the browser to bypass Angular Router entirely, preventing the bitstreamDownloadRedirectGuard from executing and causing the download to hang silently.
  • section-upload-file.component.ts: Fixed getBitstream() to return a Bitstream object with a complete _links object (including content.href) populated from fileData.url. Previously it only returned the uuid, causing the guard to hang indefinitely while waiting for _links.content.href to retrieve the secure download token.
  • section-upload-file.component.spec.ts: Added a test to verify that getBitstream() returns the correct uuid and _links from fileData.

How to test:

  1. Login as Admin on a DSpace instance
  2. Go to any Item with files → Administer → Bitstreams tab
  3. Click the download button → file should download correctly ✅
  4. Go to MyDSpace → open or create a submission with an uploaded file
  5. Click the download button next to the file → file should download correctly ✅

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using npm run lint
  • My PR doesn't introduce circular dependencies (verified via npm run check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.
  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

@lgeggleston lgeggleston added bug high priority 1 APPROVAL pull request only requires a single approval to merge testathon Reported by a tester during Community Testathon labels Apr 30, 2026
@lgeggleston lgeggleston moved this to 🙋 Needs Reviewers Assigned in DSpace 10.0 Release Apr 30, 2026
@lgeggleston
Copy link
Copy Markdown

Hello! Started to test this, but found that I couldn't replicate the original bug locally yet in order to test the fix. Currently I have similar local configuration to what was on Sandbox during testathon. @guillermo-escire Was there any particular config that you needed in order to see the download silent-hanging behavior locally?

@guillermo-escire
Copy link
Copy Markdown
Contributor Author

Hi @lgeggleston! The bug can be replicated by making sure the bitstreamDownloadRedirectGuard is active, which was introduced in #5132.

To reproduce it on the Bitstreams tab, you just need to be logged in as Admin, go to any Item -> Administer -> Bitstreams tab, and click the download button. The key is that before this fix, the button used [href] instead of [routerLink], so the guard was never triggered and the download would hang. You may need to check that your local build includes the changes from #5132.

For the Workspace/Workflow case, go to MyDSpace, open any submission with an uploaded file, and click the download button next to the file.

@tdonohue tdonohue self-requested a review May 4, 2026 19:25
Copy link
Copy Markdown
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guillermo-escire : Thanks for this PR. I've tested it today and found it only fixes one of the bugs.

It fixes the bug where you couldn't download bitstreams from the "Administer -> Bitstreams" tab. However, it does not fix the bug where you cannot download bitstreams from in progress submissions (in workspace/workflow).

Here's how to reproduce the bug I'm still seeing:

  1. First, I'm testing in production mode (npm run build:prod && npm run serve:ssr)
  2. Login as an Admin or user with submit privileges
  3. Start a new submission
  4. Immediately upload a file to that submission.
  5. Now, click the download button next to the newly uploaded file. The download will attempt to open in a new tab but will fail. The download still appears to hang.

So, I think your changes to the item-edit-bitstaream-bundle.component.html are correct, but your changes to the section-upload-file.component.ts don't appear to fix the issues when downloading from a WorkspaceItem.

@github-project-automation github-project-automation Bot moved this from 🙋 Needs Reviewers Assigned to 👀 Under Review in DSpace 10.0 Release May 5, 2026
@guillermo-escire
Copy link
Copy Markdown
Contributor Author

Hit @tdonohue , thank you for the detailed testing steps! I will investigate the Workspace/Workflow download issue further and push a fix soon.

@guillermo-escire
Copy link
Copy Markdown
Contributor Author

Hi @tdonohue, thanks for the detailed feedback! I was able to reproduce the issue in production mode following your exact steps.
The root cause was that the previous fix tried to route the download through the bitstreamDownloadRedirectGuard, which calls bitstreamDataService.findById() to resolve the bitstream. However, WorkspaceItem bitstreams are not accessible via the /api/core/bitstreams/{uuid} endpoint until they are archived, causing the guard to hang indefinitely.

The new fix replaces ds-file-download-link in section-upload-file.component.ts with a direct download button that uses FileService.retrieveFileDownloadLink() to obtain a short-lived token and opens the download link directly in a new tab, bypassing the guard entirely for this context.

I've tested it in both dev and production mode and it works correctly now. Please let me know if you need any additional changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 APPROVAL pull request only requires a single approval to merge bug high priority testathon Reported by a tester during Community Testathon

Projects

Status: 👀 Under Review

Development

Successfully merging this pull request may close these issues.

Downloads are not working from the Administer -> Bitstreams Tab or Workspace/Workflow

3 participants