Encrypted files cannot be downloaded repeatedly from the Room Files menu
Description
Downloading an encrypted file from the Room Files menu works for the first request, but subsequent download requests can fail to trigger the download.
The response listener is registered when the FileItemMenu component mounts and uses a one-time listener. Once the first download response is received, that listener is consumed. If the component remains mounted, later requests reuse the same ID, but there is no longer an active listener waiting for the response.
Steps to reproduce
- Open a room and navigate to the Files section in the contextual bar.
- Select an encrypted file.
- Open its menu and click Download.
- After the first download completes, open the menu again.
- Click Download again.
Expected behaviour
Every download request should be handled independently, allowing the same encrypted file to be downloaded multiple times without reopening the room or remounting the component.
Actual behaviour
After the first response consumes the one-time listener, subsequent responses may not trigger the download.
Suggested direction
Register a response listener for each download request and use a unique request ID to match each response to its corresponding request.
Hi, I'd like to work on this. FileItemMenu registers ee.once(uid) a single time in a useEffect and reuses the useId value for every request, so I'd register the listener inside the Download click handler with a fresh id per request (useDownloadFromServiceWorker has the same pattern, so I'd fix it there too).
hello @schizophrenicmaniac i already prepared pr with the implementation and raising it .
Regarding useDownloadFromServiceWorker, that's a good point. I will take a closer look at its implementation to check whether the same issue applies there as well.