From 1ce4a39e0b6206da6670ce9ec189665ae00a4784 Mon Sep 17 00:00:00 2001 From: lian Date: Fri, 16 Jul 2021 16:19:06 +0800 Subject: [PATCH] show detailed error msg when download folder --- .../components/dialog/zip-download-dialog.js | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/dialog/zip-download-dialog.js b/frontend/src/components/dialog/zip-download-dialog.js index a4791d7377..153646e82b 100644 --- a/frontend/src/components/dialog/zip-download-dialog.js +++ b/frontend/src/components/dialog/zip-download-dialog.js @@ -61,13 +61,21 @@ class ZipDownloadDialog extends React.Component { const zipToken = this.state.zipToken; seafileAPI.queryZipProgress(zipToken).then((res) => { const data = res.data; - this.setState({ - zipProgress: data.total == 0 ? '100%' : (data.zipped/data.total*100).toFixed(2) + '%' - }); - if (data['total'] == data['zipped']) { + if (data.failed == 1) { clearInterval(interval); - this.props.toggleDialog(); - location.href = `${fileServerRoot}zip/${zipToken}`; + this.setState({ + isLoading: false, + errorMsg: data.failed_reason + }); + } else { + this.setState({ + zipProgress: data.total == 0 ? '100%' : (data.zipped/data.total*100).toFixed(2) + '%' + }); + if (data['total'] == data['zipped']) { + clearInterval(interval); + this.props.toggleDialog(); + location.href = `${fileServerRoot}zip/${zipToken}`; + } } }).catch((error) => { clearInterval(interval);