Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/lib/common/MessageFileGallery.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
return {
file_name: item.file_name,
file_extension: item.file_extension,
file_data: isExternalUrl(item.file_url) ? item.file_url : `${PUBLIC_SERVICE_URL}${item.file_url}?access_token=${$userStore?.token}`
file_data: isExternalUrl(item.file_url) ? item.file_url : `${PUBLIC_SERVICE_URL}${item.file_url}?access_token=${$userStore?.token}`,
file_download_url: isExternalUrl(item.file_download_url) ? item.file_download_url : `${PUBLIC_SERVICE_URL}${item.file_download_url}?access_token=${$userStore?.token}`
};
});
// @ts-ignore
Expand All @@ -50,6 +51,14 @@
});
}
});

/** @param {number} idx */
function handleDownloadFile(idx) {
const found = textFiles.find((_, index) => index === idx);
if (found?.file_download_url) {
window.open(found.file_download_url);
}
}
</script>


Expand All @@ -58,6 +67,8 @@
containerStyles={galleryStyles}
files={textFiles}
showFileName
needDownload
onDownload={idx => handleDownloadFile(idx)}
/>
<AudioGallery
id={messageId}
Expand Down
1 change: 1 addition & 0 deletions src/lib/helpers/types/fileTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* @property {string} file_name - The file name.
* @property {string} [file_extension] - The file extension.
* @property {string} file_data - The file data or url.
* @property {string} [file_download_url] - The file download url.
*/

/**
Expand Down
Loading