From c5738706c47c7dada7d7665178144e1fd39bc05b Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Tue, 30 Jul 2024 17:36:33 -0700 Subject: [PATCH] download: Dispatch error notification if dataset names are empty An extra guard against empty dataset names during Auspice JSON downloads Related to --- src/components/download/helperFunctions.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/download/helperFunctions.js b/src/components/download/helperFunctions.js index 969cd8dc9..08042b396 100644 --- a/src/components/download/helperFunctions.js +++ b/src/components/download/helperFunctions.js @@ -631,6 +631,10 @@ export const entropyTSV = (dispatch, filePrefix, entropy) => { */ export const auspiceJSON = (dispatch, datasetNames) => { const filenames = []; + if (datasetNames.every((x) => x === '')) { + console.error("Unable to fetch empty dataset names"); + return dispatch(errorNotification({message: "Unable to download Auspice JSON (see console for more info)"})) + } for (const datasetName of datasetNames) { if (!datasetName) continue; // e.g. no 2nd tree const filename = datasetName.replace('/', '_') + '.json';