Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solutions/forms.py should use task.max_file_size if uploaded solution is a zip-file. #359

Open
ifrh opened this issue Dec 31, 2022 · 1 comment · May be fixed by #361
Open

solutions/forms.py should use task.max_file_size if uploaded solution is a zip-file. #359

ifrh opened this issue Dec 31, 2022 · 1 comment · May be fixed by #361

Comments

@ifrh
Copy link
Contributor

ifrh commented Dec 31, 2022

When uploading a solution as zip file, than configured task.max_file_size is not used:

if sum(fileinfo.file_size for fileinfo in zip.infolist()) > 1000000:

should use information from task.max_file_size

max_file_size_kb = task.max_file_size
max_file_size = 1024 * max_file_size_kb

If one add n single non-zip-files as solution than the upload limit is n*max_file_size
Therefor I think a possible fix is:
change solutions/forms.py L50
fromif sum(fileinfo.file_size for fileinfo in zip.infolist()) > 1000000:
to if sum(fileinfo.file_size for fileinfo in zip.infolist()) > (max_file_size * len(zip.infolist()):

@ifrh
Copy link
Contributor Author

ifrh commented Dec 31, 2022

see related PR #356

ifrh pushed a commit to ifrh/Praktomat that referenced this issue Jan 3, 2023
This fixes KITPraktomatTeam/Praktomat/KITPraktomatTeam#359 , hso-praktomat/praktomat/KITPraktomatTeam#15
@ifrh ifrh linked a pull request Jan 3, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant