mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-30 21:50:59 +00:00
Merge pull request #5179 from haiwen/max-upload-file-size
check file size before upload file via upload link
This commit is contained in:
commit
57f28a9a73
@ -49,7 +49,7 @@ class SharedUploadLink extends React.Component {
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<ol className="small text-gray">
|
<ol className="small text-gray">
|
||||||
<li className="tip-list-item">{gettext('Folder upload is limited to Chrome, Firefox 50+, and Microsoft Edge.')}</li>
|
<li className="tip-list-item">{gettext('Folder upload is limited to Chrome, Firefox 50+, and Microsoft Edge.')}</li>
|
||||||
{maxUploadFileSize && <li className="tip-list-item">{gettext('File size should be smaller than {max_size_placeholder}.').replace('{max_size_placeholder}', maxUploadFileSize)}</li>}
|
{maxUploadFileSize && <li className="tip-list-item">{gettext('File size should be smaller than {max_size_placeholder}M.').replace('{max_size_placeholder}', maxUploadFileSize)}</li>}
|
||||||
</ol>
|
</ol>
|
||||||
<div id="upload-link-drop-zone" className="text-center mt-2 mb-4">
|
<div id="upload-link-drop-zone" className="text-center mt-2 mb-4">
|
||||||
<span className="sf3-font sf3-font-upload upload-icon"></span>
|
<span className="sf3-font sf3-font-upload upload-icon"></span>
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
avatar: '{% avatar username 16 %}'
|
avatar: '{% avatar username 16 %}'
|
||||||
},
|
},
|
||||||
noQuota: {% if no_quota %} true {% else %} false {% endif %},
|
noQuota: {% if no_quota %} true {% else %} false {% endif %},
|
||||||
{% if max_upload_file_size %}
|
{% if max_upload_file_size > 0 %}
|
||||||
maxUploadFileSize: "{{max_upload_file_size|filesizeformat}}",
|
maxUploadFileSize: {{max_upload_file_size}},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
token: "{{uploadlink.token}}",
|
token: "{{uploadlink.token}}",
|
||||||
repoID: "{{uploadlink.repo_id}}",
|
repoID: "{{uploadlink.repo_id}}",
|
||||||
|
@ -405,12 +405,18 @@ def view_shared_upload_link(request, uploadlink):
|
|||||||
|
|
||||||
no_quota = True if seaserv.check_quota(repo_id) < 0 else False
|
no_quota = True if seaserv.check_quota(repo_id) < 0 else False
|
||||||
|
|
||||||
|
try:
|
||||||
|
max_upload_file_size = seafile_api.get_server_config_int('fileserver', 'max_upload_size')
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
max_upload_file_size = -1
|
||||||
|
|
||||||
return render(request, 'view_shared_upload_link_react.html', {
|
return render(request, 'view_shared_upload_link_react.html', {
|
||||||
'repo': repo,
|
'repo': repo,
|
||||||
'path': path,
|
'path': path,
|
||||||
'username': username,
|
'username': username,
|
||||||
'dir_name': dir_name,
|
'dir_name': dir_name,
|
||||||
'max_upload_file_size': seaserv.MAX_UPLOAD_FILE_SIZE,
|
'max_upload_file_size': max_upload_file_size,
|
||||||
'no_quota': no_quota,
|
'no_quota': no_quota,
|
||||||
'uploadlink': uploadlink,
|
'uploadlink': uploadlink,
|
||||||
'enable_upload_folder': ENABLE_UPLOAD_FOLDER,
|
'enable_upload_folder': ENABLE_UPLOAD_FOLDER,
|
||||||
|
Loading…
Reference in New Issue
Block a user