diff --git a/src/composables/downloadFile.js b/src/composables/downloadFile.js index 8c9e21a4f..4588265a2 100644 --- a/src/composables/downloadFile.js +++ b/src/composables/downloadFile.js @@ -2,25 +2,16 @@ import { useSession } from 'src/composables/useSession'; import { getUrl } from './getUrl'; import axios from 'axios'; import { exportFile } from 'quasar'; -import useOpenURL from './useOpenURL'; const { getTokenMultimedia } = useSession(); const token = getTokenMultimedia(); -export async function downloadFile( - id, - model = 'dms', - urlPath = '/downloadFile', - url, - newTab = true -) { +export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) { const appUrl = (await getUrl('', 'lilium')).replace('/#/', ''); - const targetUrl = - url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`; - - if (newTab) return useOpenURL(targetUrl); - - const response = await axios.get(targetUrl, { responseType: 'blob' }); + const response = await axios.get( + url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`, + { responseType: 'blob' } + ); const contentDisposition = response.headers['content-disposition']; const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition);