diff --git a/.secrets.baseline b/.secrets.baseline index e343eb4f..a233e4cf 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "^.secrets.baseline$|^.*pgsslrootcert.yml$", "lines": null }, - "generated_at": "2020-01-29T16:40:16Z", + "generated_at": "2020-01-27T19:24:43Z", "plugins_used": [ { "base64_limit": 4.5, @@ -82,7 +82,7 @@ "hashed_secret": "afc848c316af1a89d49826c5ae9d00ed769415f3", "is_secret": false, "is_verified": false, - "line_number": 31, + "line_number": 32, "type": "Secret Keyword" } ], diff --git a/atst/forms/task_order.py b/atst/forms/task_order.py index 8d40c015..2a5c1731 100644 --- a/atst/forms/task_order.py +++ b/atst/forms/task_order.py @@ -26,6 +26,7 @@ from atst.utils.localization import translate from flask import current_app as app MAX_CLIN_AMOUNT = 1_000_000_000 +FILE_SIZE_LIMIT = 64 def coerce_enum(enum_inst): @@ -164,8 +165,14 @@ class TaskOrderForm(BaseForm): ) pdf = FormField( AttachmentForm, - label=translate("task_orders.form.supporting_docs_size_limit"), - description=translate("task_orders.form.supporting_docs_size_limit"), + label=translate( + "task_orders.form.supporting_docs_size_limit", + {"file_size_limit": FILE_SIZE_LIMIT}, + ), + description=translate( + "task_orders.form.supporting_docs_size_limit", + {"file_size_limit": FILE_SIZE_LIMIT}, + ), ) clins = FieldList(FormField(CLINForm)) diff --git a/atst/routes/task_orders/new.py b/atst/routes/task_orders/new.py index eaf6f2b2..eab7812f 100644 --- a/atst/routes/task_orders/new.py +++ b/atst/routes/task_orders/new.py @@ -24,6 +24,7 @@ def render_task_orders_edit( render_args["contract_start"] = app.config.get("CONTRACT_START_DATE") render_args["contract_end"] = app.config.get("CONTRACT_END_DATE") + render_args["file_size_limit"] = int(app.config.get("FILE_SIZE_LIMIT")) if task_order_id: task_order = TaskOrders.get(task_order_id) diff --git a/config/base.ini b/config/base.ini index 3504e3cd..3294c7af 100644 --- a/config/base.ini +++ b/config/base.ini @@ -18,6 +18,7 @@ DEBUG = true DEBUG_MAILER = false DISABLE_CRL_CHECK = false ENVIRONMENT = dev +FILE_SIZE_LIMIT = 64000000 LIMIT_CONCURRENT_SESSIONS = false LOG_JSON = false MAIL_PASSWORD diff --git a/js/components/upload_input.js b/js/components/upload_input.js index d7c90bf5..ae155c48 100644 --- a/js/components/upload_input.js +++ b/js/components/upload_input.js @@ -20,6 +20,9 @@ export default { portfolioId: { type: String, }, + sizeLimit: { + type: String, + }, }, data: function() { @@ -31,6 +34,7 @@ export default { sizeError: false, filenameError: false, downloadLink: '', + fileSizeLimit: parseInt(this.sizeLimit), } }, @@ -48,7 +52,7 @@ export default { this.clearErrors() const file = e.target.files[0] - if (file.size > 64000000) { + if (file.size > this.fileSizeLimit) { this.sizeError = true return } diff --git a/templates/components/upload_input.html b/templates/components/upload_input.html index c86b6ab6..882fcaef 100644 --- a/templates/components/upload_input.html +++ b/templates/components/upload_input.html @@ -1,6 +1,6 @@ {% from "components/icon.html" import Icon %} -{% macro UploadInput(field, portfolio_id, show_label=False) -%} +{% macro UploadInput(field, portfolio_id, file_size_limit, show_label=False) -%}
@@ -47,7 +48,7 @@ {{ "forms.task_order.upload_error" | translate }}