mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
use go fileserver when download single folder
This commit is contained in:
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|||||||
import MD5 from 'MD5';
|
import MD5 from 'MD5';
|
||||||
import { UncontrolledTooltip } from 'reactstrap';
|
import { UncontrolledTooltip } from 'reactstrap';
|
||||||
import { Dropdown, DropdownToggle, DropdownItem } from 'reactstrap';
|
import { Dropdown, DropdownToggle, DropdownItem } from 'reactstrap';
|
||||||
import { gettext, siteRoot, mediaUrl, username } from '../../utils/constants';
|
import { gettext, siteRoot, mediaUrl, username, useGoFileserver, fileServerRoot } from '../../utils/constants';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import URLDecorator from '../../utils/url-decorator';
|
import URLDecorator from '../../utils/url-decorator';
|
||||||
@@ -345,9 +345,22 @@ class DirentListItem extends React.Component {
|
|||||||
let repoID = this.props.repoID;
|
let repoID = this.props.repoID;
|
||||||
let direntPath = this.getDirentPath(dirent);
|
let direntPath = this.getDirentPath(dirent);
|
||||||
if (dirent.type === 'dir') {
|
if (dirent.type === 'dir') {
|
||||||
this.setState({
|
if (!useGoFileserver) {
|
||||||
isZipDialogOpen: true
|
this.setState({
|
||||||
});
|
isZipDialogOpen: true
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
seafileAPI.zipDownload(repoID, this.props.path, this.props.dirent.name).then((res) => {
|
||||||
|
const zipToken = res.data['zip_token'];
|
||||||
|
location.href = `${fileServerRoot}zip/${zipToken}`;
|
||||||
|
}).catch((error) => {
|
||||||
|
let errorMsg = Utils.getErrorMsg(error);
|
||||||
|
this.setState({
|
||||||
|
isLoading: false,
|
||||||
|
errorMsg: errorMsg
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let url = URLDecorator.getUrl({type: 'download_file_url', repoID: repoID, filePath: direntPath});
|
let url = URLDecorator.getUrl({type: 'download_file_url', repoID: repoID, filePath: direntPath});
|
||||||
location.href = url;
|
location.href = url;
|
||||||
|
Reference in New Issue
Block a user