Skip to main content

Module files

Module files 

Source
Expand description

Handlers for HTTP requests to /api/v0/files.

Re-exportsΒ§

pub use crate::domain::models_requests::UploadClaim;

StructsΒ§

AuthorizationToken
Proof that an authorization check passed.
CmsFilesApiDoc πŸ”’
The upload routes the CMS may call. Only the unbound slug route belongs here: files a teacher attaches in the exercise editor are referenced from a spec, which never produces an exercise_task_submission_files row, so an answer-upload binding would have them reaped.
DownloadClaimQuery πŸ”’
The download claim as it rides in the URL the host puts in a grading request.
ExerciseUploadBinary πŸ”’
OpenAPI-only representation of an arbitrary multipart binary part.
FileQuery πŸ”’
FilesApiDoc πŸ”’

FunctionsΒ§

_add_routes
Add a route for each controller in this module.
download_file_name πŸ”’
requested_name, else the uploaded file’s original name, always ending in the file’s extension so the saved file still opens in the right program. The extension comes from the storage path, or from stored_name for paths stored without one.
redirect_claimed_file πŸ”’
GET /api/v0/files/claimed/:file_upload_id?download-claim=:jwt Redirects to one host-stored file, authorized by a claim naming that file.
redirect_to_storage_service πŸ”’
GET /api/v0/files/\* Redirects the request to a file storage service.
serve_upload πŸ”’
GET /api/v0/files/uploads/\* Serve local uploaded file, mostly for development.
store_answer_uploads πŸ”’
Stores the multipart parts and binds them to the exercise and user, so that a failure to record the binding cannot leave uploads the reaper is unable to find.
upload_answer_files πŸ”’
POST /api/v0/files/answer-uploads/:exercise_task_id Used to upload the files a student is attaching to an answer for the given exercise task.
upload_from_exercise_service πŸ”’
POST /api/v0/files/:exercise_service_slug Used to upload data from exercise service iframes.