The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): attaching larger images no longer crashes with a BigInt error (#34087)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 10, 2026 at 14:28 UTC
3cb99ced5b79f74628065952098cc1cf2d829f0e
2 files changed
+18
-1
apps/mobile/src/lib/attachmentUpload.test.ts
+15
@@ -321,12 +321,27 @@ describe("prepareTurnAttachments", () => {
321
322
// regression: #9713 read file-backed image drafts before enabling them
323
it("uploads a file-backed image from its owned copy without staging base64", async () => {
324
+ mocks.upload.mockImplementation(
325
+ async (
326
+ _uri: string,
327
+ _url: string,
328
+ options: { onProgress?: (event: { bytesSent: unknown; totalBytes: unknown }) => void },
329
+ ) => {
330
+ // expo-modules-jsi delivers native Int64 progress counts as BigInt.
331
+ options.onProgress?.({ bytesSent: BigInt(1), totalBytes: BigInt(4) });
332
+ return { status: 204, body: "", headers: {} };
333
+ },
334
+ );
335
+ const progress: Array<number> = [];
336
const prepared = await prepareTurnAttachments({
337
environmentId,
338
attachments: [fileBackedImage],
339
supportsImageUploads: true,
340
+ onUploadProgress: (_, value) => progress.push(value),
341
});
342
343
+ expect(progress).toEqual([0.25]);
344
+
345
expect(mocks.upload).toHaveBeenCalledWith(
346
fileBackedImage.fileUri,
347
"https://environment.example/api/attachments/upload/signed",
apps/mobile/src/lib/attachmentUpload.ts
+3
-1
@@ -232,8 +232,10 @@ async function uploadFileBytes(
232
signal,
233
...(onProgress
234
? {
235
+ // Native events carry Int64 counts, which expo-modules-jsi delivers as BigInt despite the `number` type.
236
onProgress: ({ bytesSent, totalBytes }) => {
236
- if (totalBytes > 0) onProgress(bytesSent / totalBytes);
237
+ const total = Number(totalBytes);
238
+ if (total > 0) onProgress(Number(bytesSent) / total);
239
},
240
}
241
: {}),