From 15bfacc11c2e213027191125e5e1df38eda874b5 Mon Sep 17 00:00:00 2001 From: cosa65 Date: Thu, 30 Nov 2023 11:03:29 -0300 Subject: [PATCH] Fix bug introduced with the abortController, pass signal instead of controller (if controller was null, then controller.signal would trigger an error and upload woudl fail for cell level metadata) Signed-off-by: cosa65 --- src/utils/upload/processMultipartUpload.js | 4 ++-- src/utils/upload/processUpload.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/upload/processMultipartUpload.js b/src/utils/upload/processMultipartUpload.js index c1c0e3d97e..e2aed3e29e 100644 --- a/src/utils/upload/processMultipartUpload.js +++ b/src/utils/upload/processMultipartUpload.js @@ -4,14 +4,14 @@ const FILE_CHUNK_SIZE = 10000000; const MAX_RETRIES = 2; const putPartInS3 = async ( - blob, signedUrl, onUploadProgress, currentRetry = 0, abortController = null, + blob, signedUrl, onUploadProgress, currentRetry = 0, abortSignal, ) => { try { return await axios.request({ method: 'put', data: blob, url: signedUrl, - signal: abortController.signal, + signal: abortSignal, headers: { 'Content-Type': 'application/octet-stream', }, diff --git a/src/utils/upload/processUpload.js b/src/utils/upload/processUpload.js index 5668e98e87..2082d4a9ee 100644 --- a/src/utils/upload/processUpload.js +++ b/src/utils/upload/processUpload.js @@ -18,7 +18,7 @@ import endUserMessages from 'utils/endUserMessages'; import pushNotificationMessage from 'utils/pushNotificationMessage'; const prepareAndUploadFileToS3 = async ( - file, uploadUrlParams, type, onStatusUpdate = () => { }, abortController = null, + file, uploadUrlParams, type, onStatusUpdate = () => { }, abortSignal = null, ) => { let parts = null; const { signedUrls, uploadId, fileId } = uploadUrlParams; @@ -35,7 +35,7 @@ const prepareAndUploadFileToS3 = async ( }; try { parts = await processMultipartUpload( - file, signedUrls, createOnUploadProgressForPart, abortController, + file, signedUrls, createOnUploadProgressForPart, abortSignal, ); } catch (e) { onStatusUpdate(UploadStatus.UPLOAD_ERROR); @@ -121,7 +121,7 @@ const createAndUploadSampleFile = async (file, experimentId, sampleId, dispatch, ); const uploadUrlParams = { signedUrls, uploadId, fileId: sampleFileId }; - await prepareAndUploadFileToS3(file, uploadUrlParams, 'sample', updateSampleFileUploadProgress, abortController); + await prepareAndUploadFileToS3(file, uploadUrlParams, 'sample', updateSampleFileUploadProgress, abortController.signal); } catch (e) { dispatch(updateSampleFileUpload( experimentId, sampleId, sampleFileId, fileType, UploadStatus.UPLOAD_ERROR,