-
Notifications
You must be signed in to change notification settings - Fork 121
[MBL-19470][S/T/P] Fixes issue of un-viewable file upload submissions for assignments with moderated grading #3760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
refs: MBL-19470 affects: All builds: All release note: Fixed issue of un-viewable file upload submissions for assignments with moderated grading
Claude Code ReviewUpdated: $(date) Critical Issues Found:
🔴 Issues found |
Release Note:Fixed issue of un-viewable file upload submissions for assignments with moderated grading Affected Apps: Student, Teacher, ParentBuilds: Student, Teacher, Parent
|
BuildsCommit: SwiftLint fixes (adbc294) |
refs: MBL-19470 affects: Student, Teacher, Parent builds: Student, Teacher, Parent release note: Fixed issue of un-viewable file upload submissions for assignments with moderated grading
Claude Code ReviewAnalysisChanges: Fixed double percent-encoding in URL query strings by decoding query parameters before URL construction. Issues Found:
✅ Code compiles, follows project patterns, and addresses the primary use case for moderated grading file uploads. |
Claude Code ReviewUpdated: 2025-11-18 ✅ ApprovalThe fix correctly addresses the double percent-encoding issue by stripping percent-encoding from query parameters before URL construction. Key points:
No critical issues found. ✅ |
Claude Code ReviewUpdated: 2025-11-18 ✅ Approved
No critical issues found. |
| /// percent-encoding on URL strings. | ||
| var removingQueryPercentEncoding: String { | ||
| if var comps = URLComponents(string: self) { | ||
| if let fixedQuery = comps.query?.removingPercentEncoding { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to assume 1 level of percent-encoding on backend.
Since, we don't want for the excessive percent-encoding removal to turn such value as:
"{ \"prop\": \"%5BSome%20Value%5D\" }"To this:
"{ \"prop\": \"[Some Value]\" }"
Claude Code ReviewUpdated: 2025-11-18 ✅ Approved No critical issues found. The fix correctly addresses the double percent-encoding problem with solid test coverage. |
refs: MBL-19470
affects: All
builds: All
release note: Fixed issue of un-viewable file upload submissions for assignments with moderated grading
Analysis
The issue was caused by double percent-encoding occurring while decoding
APIFile.preview_url:The parsed string is usually get percent-encoded on backend, but for the failing case the string was containing query-unsafe characters
[&], which will be percent- encoded when fed toURL.init(string:), but the unwanted result was to double encode the already encoded characters:For simplicity sake, a path like this:
/api/v1/canvadoc_session?blob=[Some%20Example]Would turn to be:
/api/v1/canvadoc_session?blob=%5BSome%2520Example%5DUpon that request always fail with
401 Unauthorizederror.The Fix
While that could be fixed from backend, I added few changes to remove the percent-encoding on the query part of the string, so it can be encoded again as a whole when using
URL(string:relativeTo:)with the resulting one. Assuming BE only perform 1 iteration of percent-encoding.Test Plan
See ticket's description for test account.
Also made sure the original case of file upload submissions still work as expected.
Checklist