-
Notifications
You must be signed in to change notification settings - Fork 81
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
Fix viewing testrun results (issue #123) #124
Conversation
Make the testrun controller check whether the input file is a zip by extension only and saves that information in the model. Change a downloaded zipped input file's name, so it has a .zip extension.
oioioi/testrun/views.py
Outdated
return stream_file(submission.input_file, name='input.in') | ||
name='input.in' | ||
if submission.input_is_zip: | ||
name+='.zip' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would return "input.in.zip", what about using "input.in" for regular inputs and "input.zip" for zip files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My rationale was that that after unzipping the user should get the same filename as the one for uncompressed input, but now I see that the zipfile contains the input in a user-named file, so it's irrelevant.
While we're at it, would you agree that the filename should contain some additional information like it does for normal ins and outs (problems_1_rok1a.in/.out
)?
I'd go with something like testruns_{submission_id}_{short_problem_name}.in/.zip/.out
.
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is data migration needed? if not I suggest to add some comment in the code why it can be skipped.
I reverted the previous commit, since by utilizing some changes from #151 (thanks @top-sekret!), we can perform full-fledged zipfile checks without messy code. Additionally, now users can't bypass the 50KiB zipped input limit by removing the |
Fixes #123.
Make the testrun controller check whether the input file is a zip by extension only and save that information in the model.
As submitted input zips are correctly validated for containing exactly one file in sioworkers anyway in
sio.executors.common._run
, the testrun module doesn't have to do that thoroughly.Without this PR, the file was checked every time it's submission was viewed and the lack of a
seek
method in filetracker seems to have been causing errors.A detailed traceback can be viewed in the issue.
Additionally, now when a zipped input file is being downloaded, it will have a
.in.zip
extension, as opposed to just.in
.