fix(android): percent-encode upload filename headers + per-item failure isolation (ISSUE-233) #1523
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/android-upload-filename-peritem"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem (user report, production)
Uploading a file named "Fødselsdagsinvitation med sportsmotiv3.png" from Android crashed twice over:
UploadSessionClientsentfilename/client-relative-pathRAW in HTTP headers; OkHttp's header-value check rejects non-Latin-1 chars before any bytes are sent.Fix (client-side only)
1. Percent-encode the fingerprint headers (
UploadSessionClient)filename+client-relative-pathnow encoded at the header boundary withencodeURIComponentsemantics (RFC 3986 UTF-8, space →%20) — mirrors the web client's wire format (apps/web/src/lib/api/upload.ts). The server already percent-decodes these once for display only (UploadActivityService.decodeOnceForDisplay), so Android was the wire-format outlier.client-file-keystays RAW: web sends it raw and the server keysupload_session_filesrows on it verbatim (upsertON CONFLICT (upload_session_id, client_file_key)); Android keys are ASCII by construction (mediastore:<id>,picker:<uri>).FileUploadfields stay raw — encoding is wire-only, display/path logic keeps the real name.2. Per-item failure isolation (
BackupEngine.run)CancellationExceptionnever swallowed.Server: verified already-safe, deliberately unchanged
fileIds == null) commits allreceived/classified/commit_pendingfiles (UploadCommitService.eligibleFiles) — the commit set is the received set.Tests
:core:test— 207 tests, 0 failures (Android:coreonly; no server code touched).UploadSessionClientTest: Danish filename sent asF%C3%B8dselsdagsinvitation%20med%20sportsmotiv3.png; ASCIIclient-file-keypassthrough; DTO keeps raw name.BackupEngineTest: local read failure isolates per item + batch still commits; failed item retries in a fresh session next run.Known issues
KNOWN_ISSUES.md:[ISSUE-233]highresolvedarea:upload(228 was taken; 233 next free).Scope
409cca549b08a7bc9f78