KITPraktomatTeam / Praktomat

quality control for programming assignments
http://pp.ipd.kit.edu/projects/praktomat/praktomat.php
GNU General Public License v2.0
46 stars 22 forks source link

Bugfix not null constraint mime type missing #343

Closed ifrh closed 2 years ago

ifrh commented 2 years ago

This pull request should fix https://github.com/KITPraktomatTeam/Praktomat/issues/336 using a workaround needed caused by Python stdlib bug https://github.com/python/cpython/issues/92455.

I changed in src/checker/tests.py all Unit Tests for R Checker which fail by NOT NULL constraint : missing mimetype for example.R And I add a mimetype for ("text/x-r-script", ".r") in src/settings/defaults.py.

Rationale: since merged pull requests in Python stdlib mimetypes.guess_type only searches for small letters to determine mimetype for files.

Because the file example.R has capital letter, a mimetype for that endig has been added using the capital letter R. https://github.com/KITPraktomatTeam/Praktomat/blob/d7707f6b4f5d9b5c1eab61d8ea80313bf0486ff4/src/settings/defaults.py#L403-L410 Sadly the current implementation of mimetypes.guess_type in Python stdlib can only handle small letters.

ifrh commented 2 years ago

Do not merge now. Some code clean up is needed

ifrh commented 2 years ago

@ratefuchs : clean up done. feel free to merge