autolab / Autolab

Course management service that enables auto-graded programming assignments.
http://www.autolabproject.com/
Apache License 2.0
752 stars 214 forks source link

Jar archives are not displayed in speedgrader #2190

Open jlge opened 1 week ago

jlge commented 1 week ago

Zip directory contains .java files and a folder with a 'MANIFEST.MF' file, but fails to display in speedgrader view.

Current behavior Binary file not displayed for entire zip image

Expected behavior Should be able to view the zip directory structure with all of it's files

20wildmanj commented 14 hours ago

More context:

While it may be the case that the viewer can't deal with binary files inside archives, this particular situation is caused by changes in the unix file command, used by the Archive.get_archive_type and Archive.archive? methods

libmagic now has many additional detectors for file formats that reuse the zip container format, including APKs, openoffice, epub, ios, and yes, files created with the jar tool. Files which match those detectors will not be shown as zip files or get the application/zip mimetype. See https://github.com/file/file/blob/master/magic/Magdir/archive#L1798-L2142 for the rules in question.

In particular, jar files will be labeled with the application/java-archive mimetype. IF autolab wants to support jar archives, this mimetype will need to be an alias for application/zip