From 77ef6180f29b572348887c43f26d3bbdf1dc1d5d Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Wed, 22 Jul 2026 10:55:49 +0300 Subject: [PATCH] fix: do not issue attachments request if there are no artifacts --- src/uploadReport.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/uploadReport.ts b/src/uploadReport.ts index 2fd82ac..e0be61e 100644 --- a/src/uploadReport.ts +++ b/src/uploadReport.ts @@ -343,13 +343,16 @@ class ReportUpload { return { success: false, message: response.error}; const webUrl = new URL(response.result.webUrl, this._options.flakinessEndpoint).toString(); - const attachmentsPresignedUrls = await this._api<{ attachmentId: string, presignedUrl: string }[]>('/api/upload/attachments', response.result.uploadToken, { - attachmentIds: this._attachments.map(a => a.id), - }); - if (attachmentsPresignedUrls?.error || !attachmentsPresignedUrls.result) - return { success: false, message: attachmentsPresignedUrls.error}; - - const attachments = new Map(attachmentsPresignedUrls.result.map(a => [a.attachmentId, a.presignedUrl])); + const attachments = new Map(); + if (this._attachments.length) { + const attachmentsPresignedUrls = await this._api<{ attachmentId: string, presignedUrl: string }[]>('/api/upload/attachments', response.result.uploadToken, { + attachmentIds: this._attachments.map(a => a.id), + }); + if (attachmentsPresignedUrls?.error || !attachmentsPresignedUrls.result) + return { success: false, message: attachmentsPresignedUrls.error}; + for (const attachment of attachmentsPresignedUrls.result) + attachments.set(attachment.attachmentId, attachment.presignedUrl); + } await Promise.all([ this._uploadReport(JSON.stringify(this._report), response.result.presignedReportUrl), ...this._attachments.map(attachment => {