1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-27 02:51:00 +00:00

Merge pull request #7751 from haiwen/upload-replace-fixup

[dir view] fixed 'upload & replace a file'(so that the related upload…
This commit is contained in:
Michael An 2025-04-23 15:51:30 +08:00 committed by GitHub
commit 75cde31370
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -630,16 +630,21 @@ class FileUploader extends React.Component {
};
replaceRepetitionFile = () => {
let resumableFile = this.resumable.files[this.resumable.files.length - 1];
let { repoID, path } = this.props;
seafileAPI.getUpdateLink(repoID, path).then(res => {
this.resumable.opts.target = res.data;
let resumableFile = this.resumable.files[this.resumable.files.length - 1];
resumableFile.formData['replace'] = 1;
resumableFile.formData['target_file'] = resumableFile.formData.parent_dir + resumableFile.fileName;
this.setState({ isUploadRemindDialogShow: false });
this.setUploadFileList(this.resumable.files);
this.resumable.upload();
this.setState({
isUploadRemindDialogShow: false,
isUploadProgressDialogShow: true,
uploadFileList: [...this.state.uploadFileList, resumableFile]
}, () => {
this.resumable.upload();
});
Utils.registerGlobalVariable('uploader', 'isUploadProgressDialogShow', true);
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
toaster.danger(errMessage);