mirror of https://github.com/zulip/zulip.git
Fix for setting file upload size through settings file.
(Slightly tweaked by Tim Abbott to change the variable name, docs, and default values). Fixes #276.
This commit is contained in:
parent
07419104a5
commit
44a9e1dff5
|
@ -953,7 +953,7 @@ $(function () {
|
|||
url: "json/upload_file",
|
||||
fallback_id: "file_input",
|
||||
paramname: "file",
|
||||
maxfilesize: 25,
|
||||
maxfilesize: page_params.maxfilesize,
|
||||
data: {
|
||||
// the token isn't automatically included in filedrop's post
|
||||
csrfmiddlewaretoken: csrf_token
|
||||
|
|
|
@ -766,6 +766,7 @@ def home(request):
|
|||
test_suite = settings.TEST_SUITE,
|
||||
poll_timeout = settings.POLL_TIMEOUT,
|
||||
login_page = settings.HOME_NOT_LOGGED_IN,
|
||||
maxfilesize = settings.MAX_FILE_UPLOAD_SIZE,
|
||||
password_auth_enabled = password_auth_enabled(user_profile.realm),
|
||||
have_initial_messages = user_has_messages,
|
||||
subbed_info = register_ret['subscriptions'],
|
||||
|
@ -1030,6 +1031,9 @@ def json_upload_file(request, user_profile):
|
|||
return json_error("You may only upload one file at a time")
|
||||
|
||||
user_file = request.FILES.values()[0]
|
||||
if ((settings.MAX_FILE_UPLOAD_SIZE * 1024 * 1024) < user_file._get_size()):
|
||||
return json_error("File Upload is larger than allowed limit")
|
||||
|
||||
uri = upload_message_image_through_web_client(request, user_file, user_profile)
|
||||
return json_success({'uri': uri})
|
||||
|
||||
|
|
|
@ -131,6 +131,11 @@ LOCAL_UPLOADS_DIR = "/home/zulip/uploads"
|
|||
#S3_AUTH_UPLOADS_BUCKET = ""
|
||||
#S3_AVATAR_BUCKET = ""
|
||||
|
||||
# Maximum allowed size of uploaded files, in megabytes. DO NOT SET
|
||||
# ABOVE 80MB. The file upload implementation doesn't support chunked
|
||||
# uploads, so browsers will crash if you try uploading larger files.
|
||||
MAX_FILE_UPLOAD_SIZE = 25
|
||||
|
||||
# Controls whether name changes are completely disabled for this installation
|
||||
# This is useful in settings where you're syncing names from an integrated LDAP/Active Directory
|
||||
NAME_CHANGES_DISABLED = False
|
||||
|
|
|
@ -120,6 +120,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
|
|||
'S3_BUCKET': '',
|
||||
'S3_AVATAR_BUCKET': '',
|
||||
'LOCAL_UPLOADS_DIR': None,
|
||||
'MAX_FILE_UPLOAD_SIZE': 25,
|
||||
'DROPBOX_APP_KEY': '',
|
||||
'ERROR_REPORTING': True,
|
||||
'JWT_AUTH_KEYS': {},
|
||||
|
|
Loading…
Reference in New Issue