From 9665a3407f4d218105c21a531382fc3ffaa7e491 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 19 Nov 2024 15:54:38 +0100 Subject: [PATCH] fix: refs #7229 remove catch --- src/composables/downloadFile.js | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/composables/downloadFile.js b/src/composables/downloadFile.js index f46697fb1..ef1a1093e 100644 --- a/src/composables/downloadFile.js +++ b/src/composables/downloadFile.js @@ -7,22 +7,18 @@ const { getTokenMultimedia } = useSession(); const token = getTokenMultimedia(); export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) { - try { - const appUrl = (await getUrl('', 'lilium')).replace('/#/', ''); - const response = await axios.get( - url ?? `${appUrl}/${model}/${id}${urlPath}?access_token=${token}`, - { responseType: 'blob' } - ); + const appUrl = (await getUrl('', 'lilium')).replace('/#/', ''); + const response = await axios.get( + url ?? `${appUrl}/${model}/${id}${urlPath}?access_token=${token}`, + { responseType: 'blob' } + ); - const contentDisposition = response.headers['content-disposition']; - const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition); - const filename = - matches != null && matches[1] - ? matches[1].replace(/['"]/g, '') - : 'downloaded-file'; + const contentDisposition = response.headers['content-disposition']; + const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition); + const filename = + matches != null && matches[1] + ? matches[1].replace(/['"]/g, '') + : 'downloaded-file'; - exportFile(filename, response.data); - } catch (error) { - console.error('Error downloading the file', error); - } + exportFile(filename, response.data); }