diff --git a/frontend/src/components/dialog/image-dialog.js b/frontend/src/components/dialog/image-dialog.js index bee697b7ff..21df1de4df 100644 --- a/frontend/src/components/dialog/image-dialog.js +++ b/frontend/src/components/dialog/image-dialog.js @@ -16,16 +16,8 @@ const propTypes = { class ImageDialog extends React.Component { - downloadImage = (imageSrc) => { - let downloadUrl = imageSrc; - if (document.getElementById('downloadFrame')) { - document.body.removeChild(document.getElementById('downloadFrame')); - } - let iframe = document.createElement('iframe'); - iframe.setAttribute('id', 'downloadFrame'); - iframe.style.display = 'none'; - iframe.src = downloadUrl; - document.body.appendChild(iframe); + downloadImage = (url) => { + location.href = url; }; onViewOriginal = () => { @@ -58,7 +50,7 @@ class ImageDialog extends React.Component { zoomInLabel={gettext('Zoom in')} zoomOutLabel={gettext('Zoom out')} enableRotate={true} - onClickDownload={() => this.downloadImage(imageItems[imageIndex].url)} + onClickDownload={() => this.downloadImage(imageItems[imageIndex].downloadURL)} onClickDelete={onDeleteImage ? () => onDeleteImage(name) : null} onViewOriginal={this.onViewOriginal} viewOriginalImageLabel={gettext('View original image')} diff --git a/frontend/src/metadata/views/gallery/index.js b/frontend/src/metadata/views/gallery/index.js index 36448ce9dc..222508d22f 100644 --- a/frontend/src/metadata/views/gallery/index.js +++ b/frontend/src/metadata/views/gallery/index.js @@ -73,6 +73,7 @@ const Gallery = () => { url: `${siteRoot}lib/${repoID}/file${path}`, src: `${siteRoot}thumbnail/${repoID}/${thumbnailSizeForGrid}${path}`, thumbnail: `${siteRoot}thumbnail/${repoID}/${thumbnailSizeForOriginal}${path}`, + downloadURL: `${fileServerRoot}repos/${repoID}/files${path}?op=download`, date: date, }; let _group = _init.find(g => g.name === date);