autolab / Autolab

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

MOSS fails to find files in archives whose pathnames start with ./ #2094

Closed damianhxy closed 3 months ago

damianhxy commented 4 months ago

In extract_asmt_for_moss, pathname.gsub!(%r{/}, "-") is performed to "flatten" nested directories.

However, if a file's pathname starts with ./, e.g. ./file, it would be renamed into the dotfile .-file. (This happens if you tar the archive via e.g. tar -cf tarred ./file1 ./file2 instead of tar -cf tarred file1 file2)

MOSS then fails to find the file since the glob expansion of assDir/*/{pattern} does not appear to include dotfiles.

To remedy this, either avoid replacing any ./ at the start of pathnames, or prepend some text after the replacement, e.g. pathname.prepend("extracted-").