From 1b4a1d57ff5adb3b4c57c2b244788c26518701f3 Mon Sep 17 00:00:00 2001 From: Jessy Barrette <30420025+JessyBarrette@users.noreply.github.com> Date: Fri, 1 Nov 2024 14:52:34 -0400 Subject: [PATCH] fix json out string and mimeTypes --- src/components/FormComponents/MetadataRecordListItem.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/FormComponents/MetadataRecordListItem.jsx b/src/components/FormComponents/MetadataRecordListItem.jsx index 62cb1d05..27bdd8eb 100644 --- a/src/components/FormComponents/MetadataRecordListItem.jsx +++ b/src/components/FormComponents/MetadataRecordListItem.jsx @@ -102,8 +102,8 @@ const MetadataRecordListItem = ({ } else if (fileType === "erddap") { data = [recordToERDDAP(record)]; } else if (fileType === "json") { - data = await [JSON.stringify(record)]; - } else if (fileType === "datacite-json") { + data = await [JSON.stringify(record, null, 2)]; + } else if (fileType === "dataciteJson") { data = await [JSON.stringify(recordToDataCite(record, language, region, datacitePrefix), null, 2)]; } else { const res = await downloadRecord({ record, fileType, region }); @@ -115,6 +115,7 @@ const MetadataRecordListItem = ({ eml: "application/xml", erddap: "application/xml", json: "application/json", + dataciteJson: "application/json", }; const blob = new Blob(data, { type: `${mimeTypes[fileType]};charset=utf-8`, @@ -392,7 +393,7 @@ const MetadataRecordListItem = ({ { - handleDownloadRecord("datacite-json"); + handleDownloadRecord("dataciteJson"); handleClose(); }} >