From e0a7f4f22d5f0e62f0cbb8ced2c8386710333f35 Mon Sep 17 00:00:00 2001 From: Blaine Gunn Date: Fri, 24 May 2024 11:03:23 -0600 Subject: [PATCH] no-cors --- acrobat/blocks/acom-widget/acom-widget.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/acrobat/blocks/acom-widget/acom-widget.js b/acrobat/blocks/acom-widget/acom-widget.js index 6bce5416..389452e8 100644 --- a/acrobat/blocks/acom-widget/acom-widget.js +++ b/acrobat/blocks/acom-widget/acom-widget.js @@ -224,13 +224,13 @@ const uploadToAdobe = async (file, progressBarWrapper, progressBar) => { // console.log(`PDF created successfully: ${metadataResult.asset_id}`); // Step 5: Fetch Download URI - const downloadUriEndpoint = `${baseApiUrl}/${expiry}/assets/download_uri?asset_uri=${encodeURIComponent(assetUri)}&make_direct_storage_uri=true`; - // eslint-disable-next-line compat/compat - const downloadUriResponse = await fetch(downloadUriEndpoint, { mode: 'no-cors', headers: { Authorization: `Bearer ${accessToken}` } }); + // const downloadUriEndpoint = `${baseApiUrl}/${expiry}/assets/download_uri?asset_uri=${encodeURIComponent(assetUri)}&make_direct_storage_uri=true`; + // // eslint-disable-next-line compat/compat + // const downloadUriResponse = await fetch(downloadUriEndpoint, { mode: 'no-cors', headers: { Authorization: `Bearer ${accessToken}` } }); - if (!downloadUriResponse.ok) { - throw new Error(`Failed to fetch download URI: ${downloadUriResponse.statusText}`); - } + // if (!downloadUriResponse.ok) { + // throw new Error(`Failed to fetch download URI: ${downloadUriResponse.statusText}`); + // } const downloadUriResult = await downloadUriResponse.json(); const downloadUri = downloadUriResult.uri; @@ -242,6 +242,7 @@ const uploadToAdobe = async (file, progressBarWrapper, progressBar) => { itemType: 'application/pdf', }; + console.log(`${baseApiUrl}/${expiry}/assets/download_uri?asset_uri=${encodeURIComponent(assetUri)}&make_direct_storage_uri=true`); const encodedBlobUrl = encodeBlobUrl(blobUrlStructure); const blobViewerUrl = `https://acrobat.adobe.com/blob/${encodedBlobUrl}?defaultRHPFeature=verb-quanda&x_api_client_location=chat_pdf&pdfNowAssetUri=${assetUri}#${downloadUri}`; console.log('Blob URL:', blobViewerUrl);