Skip to content

Commit

Permalink
fix: Attachments not downloading on non-encrypted rooms (#32837)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriellsh authored Jul 22, 2024
1 parent 88e5219 commit 703af95
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/hungry-wombats-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed an issue where non-encrypted attachments were not being downloaded
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,21 @@ const GenericFileAttachment = ({
const { t } = useTranslation();

const handleTitleClick = (event: UIEvent): void => {
if (openDocumentViewer && link) {
if (!link) {
return;
}

if (openDocumentViewer && format === 'PDF') {
event.preventDefault();

if (format === 'PDF') {
const url = new URL(getURL(link), window.location.origin);
url.searchParams.set('contentDisposition', 'inline');
openDocumentViewer(url.toString(), format, '');
return;
}
const url = new URL(getURL(link), window.location.origin);
url.searchParams.set('contentDisposition', 'inline');
openDocumentViewer(url.toString(), format, '');
return;
}

if (link.includes('/file-decrypt/')) {
event.preventDefault();

registerDownloadForUid(uid, t, title);
forAttachmentDownload(uid, link);
Expand Down

0 comments on commit 703af95

Please sign in to comment.