mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:42:04 +08:00
dba6a5eabf
The file size error messages for max_image_size_kb and max_attachment_size_kb are shown to the user in the KB format, regardless of how large the limit is. Since we are going to support uploading much larger files soon, this KB-based limit soon becomes unfriendly to the end user. For example, if the max attachment size is set to 512000 KB, this is what the user sees: > Sorry, the file you are trying to upload is too big (maximum size is 512000KB) This makes the user do math. In almost all file explorers that a regular user would be familiar width, the file size is shown in a format based on the maximum increment (e.g. KB, MB, GB). This commit changes the behaviour to output a humanized file size instead of the raw KB. For the above example, it would now say: > Sorry, the file you are trying to upload is too big (maximum size is 512 MB) This humanization also handles decimals, e.g. 1536KB = 1.5 MB |
||
---|---|---|
.. | ||
backup_restore | ||
compression | ||
content_security_policy | ||
i18n | ||
imap/providers | ||
onebox | ||
seed_data | ||
site_settings | ||
topic_query | ||
validators | ||
webauthn | ||
bookmark_manager_spec.rb | ||
bookmark_query_spec.rb | ||
bookmark_reminder_notification_handler_spec.rb | ||
browser_detection_spec.rb | ||
content_security_policy_spec.rb | ||
db_helper_spec.rb | ||
discourse_js_processor_spec.rb | ||
encodings_spec.rb | ||
introduction_updater_spec.rb | ||
mini_sql_multisite_connection_spec.rb | ||
onebox_spec.rb | ||
post_jobs_enqueuer_spec.rb | ||
search_spec.rb | ||
shrink_uploaded_image_spec.rb | ||
theme_flag_modifier_spec.rb | ||
theme_javascript_compiler_spec.rb | ||
topic_upload_security_manager_spec.rb | ||
upload_creator_spec.rb | ||
upload_recovery_spec.rb | ||
upload_security_spec.rb |