fix: File not getting download when clicked on its name #2800
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #2763, #2764, #2723, #2615 (may be)
It was observed in the mentioned issue that the users of the desktop app (only) were not able to download the file when clicked on it's name. Though, it was possible by clicking on the little cloud icon. So, this was a discrepancy in the UX. During my investigation I have found that the issue lies in the Rocket.Chat's web view although it's behaviour is pretty suitable for the browser. But for desktop, we can fix it here.
It was observed that it's caused due to the difference in the
link building
or<a>
tag in the rocket chat's web view. Here're the differences:The difference is in the attributes of
href
anddownload
. The working element?download
applied at the end of the file's URL in thehref
attributeTo solve this issue, I have attached an event listener to the DOM of the Rocket.Chat's webview and whenever a link is clicked it checks whether the link is meant to download a file or not.
If it is, a new temporary element (
<a>
) is created in the DOM with the modified attributes to process the download of the file.Here're the results:
