1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-07 01:41:39 +00:00

repair upload file bug in shared uploaded link

This commit is contained in:
shanshuirenjia
2021-04-19 15:26:35 +08:00
parent 866e84e692
commit ff61c885fb
2 changed files with 15 additions and 11 deletions

View File

@@ -27,6 +27,7 @@ const propTypes = {
fileTypeErrorCallback: PropTypes.func,
dragAndDrop: PropTypes.bool.isRequired,
path: PropTypes.string.isRequired,
uploadUrlPath: PropTypes.string.isRequired,
onFileUploadSuccess: PropTypes.func.isRequired
};
@@ -203,8 +204,8 @@ class FileUploader extends React.Component {
});
} else {
this.setUploadFileList(this.resumable.files);
let { token } = this.props;
seafileAPI.sharedLinkGetFileUploadUrl(token).then(res => {
let { token, uploadUrlPath } = this.props;
seafileAPI.sharedLinkGetFileUploadUrl(token, uploadUrlPath).then(res => {
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
this.resumableUpload(resumableFile);
}).catch(error => {
@@ -216,8 +217,8 @@ class FileUploader extends React.Component {
this.setUploadFileList(this.resumable.files);
if (!this.isUploadLinkLoaded) {
this.isUploadLinkLoaded = true;
let { token } = this.props;
seafileAPI.sharedLinkGetFileUploadUrl(token).then(res => {
let { token, uploadUrlPath } = this.props;
seafileAPI.sharedLinkGetFileUploadUrl(token, uploadUrlPath).then(res => {
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
this.resumable.upload();
}).catch(error => {
@@ -563,8 +564,8 @@ class FileUploader extends React.Component {
onUploadRetry = (resumableFile) => {
let { token } = this.props;
seafileAPI.sharedLinkGetFileUploadUrl(token).then(res => {
let { token, uploadUrlPath } = this.props;
seafileAPI.sharedLinkGetFileUploadUrl(token, uploadUrlPath).then(res => {
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
let retryFileList = this.state.retryFileList.filter(item => {
@@ -590,8 +591,8 @@ class FileUploader extends React.Component {
onUploadRetryAll = () => {
let { token } = this.props;
seafileAPI.sharedLinkGetFileUploadUrl(token).then(res => {
let { token, uploadUrlPath } = this.props;
seafileAPI.sharedLinkGetFileUploadUrl(token, uploadUrlPath).then(res => {
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
this.state.retryFileList.forEach(item => {
item.error = false;
@@ -644,8 +645,8 @@ class FileUploader extends React.Component {
uploadFile = () => {
let resumableFile = this.resumable.files[this.resumable.files.length - 1];
let { token } = this.props;
seafileAPI.sharedLinkGetFileUploadUrl(token).then(res => {
let { token, uploadUrlPath } = this.props;
seafileAPI.sharedLinkGetFileUploadUrl(token, uploadUrlPath).then(res => {
this.resumable.opts.target = res.data.upload_link + '?ret-json=1';
this.setState({
isUploadRemindDialogShow: false,

View File

@@ -19,7 +19,7 @@ import './css/grid-view.css';
moment.locale(window.app.config.lang);
let loginUser = window.app.pageOptions.name;
const {
let {
token, dirName, dirPath, sharedBy,
repoID, path,
mode, thumbnailSize, zipped,
@@ -27,6 +27,8 @@ const {
noQuota, canUpload
} = window.shared.pageOptions;
dirPath = dirPath.replace(/\/+$/, ""); // used for upload file
const uploadUrlPath = path.replace(/\/+$/, ""); // used for get dir upload link
const showDownloadIcon = !trafficOverLimit && canDownload;
class SharedDirView extends React.Component {
@@ -310,6 +312,7 @@ class SharedDirView extends React.Component {
dragAndDrop={false}
token={token}
path={dirPath}
uploadUrlPath={uploadUrlPath}
repoID={repoID}
onFileUploadSuccess={this.onFileUploadSuccess}
/>