diff --git a/src/components/Project/ImageAnalysis/ImageDownloadMenu.vue b/src/components/Project/ImageAnalysis/ImageDownloadMenu.vue index 61e2ee0..7437941 100644 --- a/src/components/Project/ImageAnalysis/ImageDownloadMenu.vue +++ b/src/components/Project/ImageAnalysis/ImageDownloadMenu.vue @@ -24,17 +24,16 @@ defineEmits(['analysisAction']) const alertStore = useAlertsStore() function downloadLink(link, filename, fileType='file'){ - if(!link){ - alertStore.setAlert('error', `No ${fileType} available for download`) - return + try{ + const a = document.createElement('a') + a.href = link + a.download = filename + document.body.appendChild(a) + a.click() + document.body.removeChild(a) + } catch (error) { + alertStore.setAlert('error', `Failed to download ${fileType} file`) } - // Create a link element and click it to download the file - const a = document.createElement('a') - a.href = link - a.download = filename - document.body.appendChild(a) - a.click() - document.body.removeChild(a) } diff --git a/src/stores/thumbnails.js b/src/stores/thumbnails.js index 4337b8a..902f374 100644 --- a/src/stores/thumbnails.js +++ b/src/stores/thumbnails.js @@ -114,6 +114,8 @@ export const useThumbnailsStore = defineStore('thumbnails', { if (cachedUrl === undefined || cachedUrl === ''){ return getImageFromBasename(size, archive, url, basename).then((response) => { if (response){ + // Convert to image/jpeg for caching as S3 presigned URLs blobs default to binary/octet-stream + response.headers.set('content-type', 'image/jpeg') return response.blob() } return undefined