fix: Attachments not downloading on non-encrypted rooms (#32837)

pull/32632/head^2
gabriellsh 1 year ago committed by GitHub
parent 88e5219bd2
commit 703af95e65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      .changeset/hungry-wombats-act.md
  2. 20
      apps/meteor/client/components/message/content/attachments/file/GenericFileAttachment.tsx

@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---
Fixed an issue where non-encrypted attachments were not being downloaded

@ -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);

Loading…
Cancel
Save