1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 14:42:10 +00:00

repair upload file which size is 0 bug (#4015)

This commit is contained in:
杨顺强
2019-08-22 16:59:44 +08:00
committed by Daniel Pan
parent 3e65a3a313
commit 2b9257acf9
2 changed files with 4 additions and 4 deletions

View File

@@ -43,7 +43,7 @@ class FileUploader extends React.Component {
isUploadProgressDialogShow: false,
isUploadRemindDialogShow: false,
currentResumableFile: null,
uploadBitrate: '0',
uploadBitrate: 0,
allFilesUploaded: false,
};
@@ -74,6 +74,7 @@ class FileUploader extends React.Component {
generateUniqueIdentifier: this.generateUniqueIdentifier,
forceChunkSize: true,
maxChunkRetries: 3,
minFileSize: 0,
});
this.resumable.assignBrowse(this.uploadInput.current, true);
@@ -410,7 +411,7 @@ class FileUploader extends React.Component {
setHeaders = (resumableFile, resumable) => {
let offset = resumable.offset;
let chunkSize = resumable.getOpt('chunkSize');
let fileSize = resumableFile.size;
let fileSize = resumableFile.size === 0 ? 1 : resumableFile.size;
let startByte = offset !== 0 ? offset * chunkSize : 0;
let endByte = Math.min(fileSize, (offset + 1) * chunkSize) - 1;
@@ -594,7 +595,6 @@ class FileUploader extends React.Component {
var firedRetry = false;
resumableFile.resumableObj.on('chunkingComplete', () => {
if(!firedRetry) {
console.log(path);
seafileAPI.getFileUploadedBytes(repoID, path, fileName).then(res => {
let uploadedBytes = res.data.uploadedBytes;
let blockSize = parseInt(resumableUploadFileBlockSize) * 1024 * 1024 || 1024 * 1024;

View File

@@ -5,7 +5,7 @@ import UploadListItem from './upload-list-item';
import { Utils } from '../../utils/utils';
const propTypes = {
uploadBitrate: PropTypes.string.isRequired,
uploadBitrate: PropTypes.number.isRequired,
totalProgress: PropTypes.number.isRequired,
retryFileList: PropTypes.array.isRequired,
uploadFileList: PropTypes.array.isRequired,