diff --git a/frontend/src/components/file-uploader/file-uploader.js b/frontend/src/components/file-uploader/file-uploader.js index ff10542969..3d1d83b743 100644 --- a/frontend/src/components/file-uploader/file-uploader.js +++ b/frontend/src/components/file-uploader/file-uploader.js @@ -2,7 +2,7 @@ import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import Resumablejs from '@seafile/resumablejs'; import MD5 from 'MD5'; -import { enableResumableFileUpload } from '../../utils/constants'; +import { enableResumableFileUpload, resumableUploadFileBlockSize } from '../../utils/constants'; import { seafileAPI } from '../../utils/seafile-api'; import { Utils } from '../../utils/utils'; import { gettext } from '../../utils/constants'; @@ -66,7 +66,7 @@ class FileUploader extends React.Component { testChunks: this.props.testChunks || false, headers: this.setHeaders || {}, withCredentials: this.props.withCredentials || false, - chunkSize: this.props.chunkSize, + chunkSize: parseInt(resumableUploadFileBlockSize) * 1024 * 1024 || 1 * 1024 * 1024, simultaneousUploads: this.props.simultaneousUploads || 1, fileParameterName: this.props.fileParameterName, generateUniqueIdentifier: this.generateUniqueIdentifier, diff --git a/frontend/src/utils/constants.js b/frontend/src/utils/constants.js index 10e3dfc892..3fdd4606b3 100644 --- a/frontend/src/utils/constants.js +++ b/frontend/src/utils/constants.js @@ -36,6 +36,7 @@ export const enableResetEncryptedRepoPassword = window.app.pageOptions.enableRes export const isEmailConfigured = window.app.pageOptions.isEmailConfigured === 'True'; export const enableUploadFolder = window.app.pageOptions.enableUploadFolder === 'True'; export const enableResumableFileUpload = window.app.pageOptions.enableResumableFileUpload === 'True'; +export const resumableUploadFileBlockSize = window.app.pageOptions.resumableUploadFileBlockSize; export const storages = window.app.pageOptions.storages; // storage backends export const enableRepoSnapshotLabel = window.app.pageOptions.enableRepoSnapshotLabel; export const shareLinkPasswordMinLength = window.app.pageOptions.shareLinkPasswordMinLength; diff --git a/seahub/templates/base_for_react.html b/seahub/templates/base_for_react.html index d0a86868e8..81196c0397 100644 --- a/seahub/templates/base_for_react.html +++ b/seahub/templates/base_for_react.html @@ -64,6 +64,7 @@ isEmailConfigured: '{{ is_email_configured }}', enableUploadFolder: '{{ enable_upload_folder }}', enableResumableFileUpload: '{{ enable_resumable_fileupload }}', + resumableUploadFileBlockSize: '{{ resumable_upload_file_block_size }}', // storage backends storages: (function () { // for 'create repo' & 'storage backend' column in 'my libs' diff --git a/seahub/views/__init__.py b/seahub/views/__init__.py index c0cd38b54c..cd2ccd6f72 100644 --- a/seahub/views/__init__.py +++ b/seahub/views/__init__.py @@ -1256,6 +1256,7 @@ def react_fake_view(request, **kwargs): 'seafile_collab_server': SEAFILE_COLLAB_SERVER, 'storages': get_library_storages(request), 'enable_repo_snapshot_label': settings.ENABLE_REPO_SNAPSHOT_LABEL, + 'resumable_upload_file_block_size': settings.RESUMABLE_UPLOAD_FILE_BLOCK_SIZE, 'share_link_expire_days_default': settings.SHARE_LINK_EXPIRE_DAYS_DEFAULT, 'share_link_expire_days_min': SHARE_LINK_EXPIRE_DAYS_MIN, 'share_link_expire_days_max': SHARE_LINK_EXPIRE_DAYS_MAX,