From 52022f4d31ccdb3df055658b71f57484dfc015be Mon Sep 17 00:00:00 2001 From: Ahmad Altaher Alfayad Date: Tue, 23 Apr 2024 14:53:14 -0400 Subject: [PATCH 1/5] Hotfix - fix wrongly named variable in setAcceptType --- assets/js/Components/FilesModal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/Components/FilesModal.js b/assets/js/Components/FilesModal.js index aa7e04ae..5043f6db 100644 --- a/assets/js/Components/FilesModal.js +++ b/assets/js/Components/FilesModal.js @@ -77,7 +77,7 @@ class FilesModal extends React.Component { break default: - accept = fileType + accept = file.fileType break } From a6f101ce7c92c82e8aaba144aea6adae64e60e92 Mon Sep 17 00:00:00 2001 From: Ahmad Altaher Alfayad Date: Wed, 24 Apr 2024 11:50:10 -0400 Subject: [PATCH 2/5] update nginx conf and php.ini to increase maximum file size --- build/nginx/deploy.conf | 3 ++- build/nginx/local.conf | 3 ++- build/nginx/php-custom.ini | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build/nginx/deploy.conf b/build/nginx/deploy.conf index 48167ce8..b8239445 100644 --- a/build/nginx/deploy.conf +++ b/build/nginx/deploy.conf @@ -9,6 +9,7 @@ server { rewrite ^/udoit3/(.*)$ /$1 break; try_files $uri @symfonyFront; + client_max_body_size 10M; } set $symfonyRoot /var/www/html/public; @@ -29,4 +30,4 @@ server { } error_log /var/log/nginx/project_error.log; access_log /var/log/nginx/project_access.log; -} \ No newline at end of file +} diff --git a/build/nginx/local.conf b/build/nginx/local.conf index 65ebd3eb..4f037e1e 100644 --- a/build/nginx/local.conf +++ b/build/nginx/local.conf @@ -9,6 +9,7 @@ server { rewrite ^/udoit3/(.*)$ /$1 break; try_files $uri @symfonyFront; + client_max_body_size 10M; } set $symfonyRoot /var/www/html/public; @@ -29,4 +30,4 @@ server { } error_log /var/log/nginx/project_error.log; access_log /var/log/nginx/project_access.log; -} \ No newline at end of file +} diff --git a/build/nginx/php-custom.ini b/build/nginx/php-custom.ini index 7c7de96e..b5d5e8d3 100644 --- a/build/nginx/php-custom.ini +++ b/build/nginx/php-custom.ini @@ -1,2 +1,4 @@ max_execution_time = 180 memory_limit = 800M +upload_max_filesize = 10M +post_max_size = 10M From 788731beca726a2a6a89625c1da7cb1ada59b229 Mon Sep 17 00:00:00 2001 From: Ahmad Altaher Alfayad Date: Fri, 26 Apr 2024 14:27:35 -0400 Subject: [PATCH 3/5] Add file size too large error for file uploads --- assets/js/Components/FilesModal.js | 7 +++++++ translations/en.json | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/assets/js/Components/FilesModal.js b/assets/js/Components/FilesModal.js index 5043f6db..f34e5888 100644 --- a/assets/js/Components/FilesModal.js +++ b/assets/js/Components/FilesModal.js @@ -249,6 +249,13 @@ class FilesModal extends React.Component { return } + if(file.size > 1024 * 1024 * 10) { + this.addMessage({severity: 'error', message: this.props.t('msg.file.replace.file_size'), timeout: 5000}) + this.setState({ replaceFileObj: null }) + this.forceUpdate() + return + } + this.setState({ replaceFileObj: file }) } diff --git a/translations/en.json b/translations/en.json index 816e1b07..a3c5b4fe 100644 --- a/translations/en.json +++ b/translations/en.json @@ -133,6 +133,7 @@ "msg.sync.started": "Course scan started.", "msg.sync.failed": "Course scan failed. Course is missing.", "msg.file.replace.file_type": "File type not accepted. Please input a file with the correct filetype.", + "msg.file.replace.file_size": "File size too large. Please input a file with a size less than 10MB", "msg.sync.completed": "Course scan completed.", "msg.sync.course_inactive": "Course scan failed. Course is inactive.", @@ -384,4 +385,4 @@ "rule.label.SearchKeyWord": "Keyword found", "rule.desc.SearchKeyWord": "The keyword has been found" -} \ No newline at end of file +} From 6c0b0b972b0429f54cb0716df75ccbefe13150fb Mon Sep 17 00:00:00 2001 From: Daniel Molares Date: Fri, 26 Apr 2024 19:09:49 -0400 Subject: [PATCH 4/5] Added spanish translation for 10mb+ file size error --- translations/es.json | 1 + 1 file changed, 1 insertion(+) diff --git a/translations/es.json b/translations/es.json index 001df103..b14aa810 100644 --- a/translations/es.json +++ b/translations/es.json @@ -133,6 +133,7 @@ "msg.sync.started": "Se inició el escaneo del curso.", "msg.sync.failed": "Falló el escaneo del curso. Falta el curso.", "msg.file.replace.file_type": "El tipo de archivo no es válido. Por favor aporte un archivo de tipo correcto.", + "msg.file.replace.file_size": "El tamaño del archivo es demasiado grande. Por favor aporte un archivo de tamaño menor a 10MB", "msg.sync.completed": "Escaneo del curso completado.", "msg.sync.course_inactive": "Falló el escaneo del curso. El curso está inactivo.", From b2846aad57bc30f6a51d006a9c50b47fd13219ba Mon Sep 17 00:00:00 2001 From: Ahmad Altaher Alfayad <93749906+taheralfayad@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:14:44 -0400 Subject: [PATCH 5/5] change file_size error wording Co-authored-by: Daniel Molares <70301465+dmols@users.noreply.github.com> --- translations/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations/en.json b/translations/en.json index a3c5b4fe..58010526 100644 --- a/translations/en.json +++ b/translations/en.json @@ -133,7 +133,7 @@ "msg.sync.started": "Course scan started.", "msg.sync.failed": "Course scan failed. Course is missing.", "msg.file.replace.file_type": "File type not accepted. Please input a file with the correct filetype.", - "msg.file.replace.file_size": "File size too large. Please input a file with a size less than 10MB", + "msg.file.replace.file_size": "File size too large. Please input a file of a size less than 10MB", "msg.sync.completed": "Course scan completed.", "msg.sync.course_inactive": "Course scan failed. Course is inactive.",