diff --git a/changelog.txt b/changelog.txt index 550d66f7..2771987c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,7 +2,6 @@ change tester uid to value other than 1000 as this causes problems with WSL2 - # 4.18.2 * bugfix nginx configuration: large requests diff --git a/nginx/nginx.conf b/nginx/nginx.conf index d767f814..b10a4f49 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -6,7 +6,7 @@ server { listen 80; # increase upload size to 5 MB (default: 1MB) - client_max_body_size 5M; + client_max_body_size 50M; # server_name server.domain.org; @@ -42,8 +42,8 @@ server { # ssl_certificate /etc/nginx/certs/server.crt; # ssl_certificate_key /etc/nginx/certs/server.key; - # increase upload size to 5 MB (default: 1MB) -# client_max_body_size 5M; + # increase upload size to 50 MB (default: 1MB) +# client_max_body_size 50M; # forward to django # location / { diff --git a/src/VERSION.py b/src/VERSION.py index fc97585c..44b5bc96 100644 --- a/src/VERSION.py +++ b/src/VERSION.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -version = "Version 4.18.3 | 20240208" +version = "Version 4.18.3 | 20240208" \ No newline at end of file diff --git a/src/checker/checker/JUnitChecker.py b/src/checker/checker/JUnitChecker.py index 2d687929..9d211dab 100644 --- a/src/checker/checker/JUnitChecker.py +++ b/src/checker/checker/JUnitChecker.py @@ -149,8 +149,22 @@ def remove_deprecated_warning(text): return text def run(self, env): + # Special treatment for test cases that want to analyze the original Java student code. + # Normally, all Java files are deleted after compilation to prevent a student from reading the test code. + # If there is only one file in this sandbox folder (student code), then it will be restored after deletion. + # This is only done if the student code consists of exactly one file, + # otherwise there is a risk that the student code contains test files that would overwrite the teacher's tests. + from pathlib import Path + files = list(Path(env.tmpdir()).rglob("*.[jJ][aA][vV][aA]")) + if len(files) == 1: + # create backup file + logger.debug(files[0]) + import shutil + shutil.copyfile(str(files[0].absolute()), str(files[0].absolute()) + '__.bak') + self.copy_files(env) + # compile test logger.debug('JUNIT Checker build') java_builder = IgnoringJavaBuilder(_flags="", _libs=self.junit_version, _file_pattern=r"^.*\.[jJ][aA][vV][aA]$", @@ -181,6 +195,11 @@ def run(self, env): logger.error(output) logger.error(error) + if len(files) == 1: + # restore single backup file in case of Java parser testcode + import shutil + shutil.copyfile(str(files[0].absolute()) + '__.bak', str(files[0].absolute())) + # run test logger.debug('JUNIT Checker run') environ = {}