Expand description
Streams every file-typed answer of one exercise to a teacher as a zip archive.
Entries are named positionally rather than from file_uploads.name, so that a plugin which
anonymizes filenames for its own views cannot leak the real ones through this export.
StructsΒ§
- Archive
Sink π - Writes the archive bytes into the streaming response channel as they are produced, waiting when the client is not reading them fast enough.
ConstantsΒ§
- ARCHIVE_
CHANNEL_ πCAPACITY - How many written chunks may sit between the archive writer and the client before the writer has to wait. The producer reads from the file store as fast as it is served, so without a bound a slow client makes the whole archive accumulate in memory.
- MIME_
EXTENSIONS π - Extensions for the mime types answer files realistically arrive as. Anything else is written without an extension rather than guessed at.
FunctionsΒ§
- content_
disposition attachment; filename="..."for an exerciseβs archive.- entry_
name π <user_id>/<submission_id>/<order_number><ext>, so that the two things a teacher needs to identify an answer come from host-owned data only.- extension_
for_ πmime - The extension to give an archive entry, without the leading dot.
Nonefor a mime type we have no confident extension for, includingapplication/octet-stream. - filename_
component π - Lowercased
[a-z0-9-]rendering of user-authored text, for use inside a download filename. - stream_
exercise_ answer_ files - Starts the archive download for one exercise.
- write_
archive π