core: check for file existence before calling downloadFile

This commit is contained in:
Abdullah Atta
2023-09-20 20:25:24 +05:00
committed by Ammar Ahmed
parent e62267042e
commit 1f2948c9a5

View File

@@ -36,6 +36,16 @@ export default class FileStorage {
this.downloads.set(groupId, files);
for (const file of files) {
const { filename, metadata, chunkSize } = file;
if (await this.exists(filename)) {
EV.publish(EVENTS.fileDownloaded, {
success: true,
groupId,
filename,
eventData
});
continue;
}
const url = `${hosts.API_HOST}/s3?name=${filename}`;
const { execute, cancel } = this.fs.downloadFile(filename, {
metadata,