Skip to content

Add opt-in resumable uploads to the file upload URL endpoint#5995

Open
rtibbles wants to merge 2 commits into
learningequality:hotfixesfrom
rtibbles:resumable_uploads
Open

Add opt-in resumable uploads to the file upload URL endpoint#5995
rtibbles wants to merge 2 commits into
learningequality:hotfixesfrom
rtibbles:resumable_uploads

Conversation

@rtibbles

@rtibbles rtibbles commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

Add opt-in resumable upload to the file upload URL endpoint.
Do this to allow resumable uploads and upload of much larger files.

References

Fixes #5975

Reviewer guidance

  • size validation changed from float to integer (FileUploadURLSerializer) — fractional sizes now 400. In the frontend of Studio we send the file size in bytes as reported by the input element.
  • Non-resumable uploads over 500 MB (MAX_NON_RESUMABLE_UPLOAD_SIZE) are now rejected and must opt into resumable - no impact on client side uploads in Studio.
  • Resumable path is only on GCS for now to unlock it for ricecooker upload - added a follow up issue to handle adding it for minio.
  • Response shape differs by branch: resumable omits mimetype/might_skip and returns alreadyUploaded
  • Integrity: md5 is pinned on the blob so GCS validates on completion; session size is advisory declared-size metadata only, enforced by a separate post-completion hook.

AI usage

Used Claude Code to implement the endpoint and GCS storage helpers, following the existing presigned-URL flow. Reviewed the diff in a local self-review pass — tightened the test suite to assert behavior rather than DRF/mock internals, and named the md5 helper so its base64 return is clear at the call site. Verified with the backend test suite.

rtibbles and others added 2 commits June 25, 2026 11:33
- supports_resumable flag on the GCS storage backends
- get_stored_object_md5: dedup lookup against an object's GCS-computed md5
- create_resumable_upload_session: pins md5 + declared-size metadata
- hex_to_base64 checksum helper

Part of learningequality#5975.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UzUP3UYP4cLyouvssXyekj
- accept a `resumable` flag (defaults off)
- GCS: skip when the stored md5 matches the checksum, else return a server-initiated resumable session URI
- non-GCS backends fall back to single-PUT
- reject non-resumable uploads over 500 MB
- make `size` an IntegerField, dropping the redundant float casts

Part of learningequality#5975.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UzUP3UYP4cLyouvssXyekj
@rtibbles rtibbles marked this pull request as ready for review June 26, 2026 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant