1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-22 03:47:09 +00:00

Fix download file bug in grid mode right click (#7418)

* fix download file use different API

* change error message
This commit is contained in:
Michael An
2025-01-23 12:49:54 +08:00
committed by GitHub
parent 689b5cba83
commit f590e7741d
3 changed files with 35 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { siteRoot, gettext, username, enableSeadoc, thumbnailSizeForOriginal, thumbnailDefaultSize, fileServerRoot, enableWhiteboard } from '../../utils/constants';
import { siteRoot, gettext, username, enableSeadoc, thumbnailSizeForOriginal, thumbnailDefaultSize, fileServerRoot, enableWhiteboard, useGoFileserver } from '../../utils/constants';
import { Utils } from '../../utils/utils';
import TextTranslation from '../../utils/text-translation';
import URLDecorator from '../../utils/url-decorator';
@@ -340,10 +340,20 @@ class DirentListView extends React.Component {
return dirent.name;
});
this.setState({
isProgressDialogShow: true,
downloadItems: selectedDirentNames
});
if (useGoFileserver) {
seafileAPI.zipDownload(repoID, path, selectedDirentNames).then((res) => {
const zipToken = res.data['zip_token'];
location.href = `${fileServerRoot}zip/${zipToken}`;
}).catch((error) => {
let errorMsg = Utils.getErrorMsg(error);
toaster.danger(errorMsg);
});
} else {
this.setState({
isProgressDialogShow: true,
downloadItems: selectedDirentNames
});
}
}
};