1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-02 07:47:32 +00:00

fix image download failed in dialog (#6844)

* rebase

* fix image download url

---------

Co-authored-by: zhouwenxuan <aries@Mac.local>
This commit is contained in:
Aries 2024-10-11 10:37:37 +08:00 committed by GitHub
parent 8d7b17276c
commit cdc9ff6fa0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 11 deletions

View File

@ -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')}

View File

@ -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);