π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Let the caller decide
Manav Rathi66c64d0c58f6
diff --git a/web/apps/photos/src/services/upload/uploadService.ts b/web/apps/photos/src/services/upload/uploadService.tsindex f3e8b852e9..6bfbcb1034 100644--- a/web/apps/photos/src/services/upload/uploadService.ts+++ b/web/apps/photos/src/services/upload/uploadService.ts@@ -438,14 +438,12 @@ const readFileOrPath = async (}} else {const path = fileOrPath;- const { stream, size } = await readStream(path);+ const { response, size } = await readStream(path);if (size > MULTIPART_PART_SIZE) {const chunkCount = Math.ceil(size / FILE_READER_CHUNK_SIZE);- dataOrStream = { stream, chunkCount };+ dataOrStream = { stream: response.body, chunkCount };} else {- dataOrStream = new Uint8Array(- await new Response(stream).arrayBuffer(),- );+ dataOrStream = new Uint8Array(await response.arrayBuffer());}}diff --git a/web/apps/photos/src/utils/native-stream.ts b/web/apps/photos/src/utils/native-stream.tsindex aef06845c0..52da84f99d 100644--- a/web/apps/photos/src/utils/native-stream.ts+++ b/web/apps/photos/src/utils/native-stream.ts@@ -14,13 +14,17 @@* @param path The path on the file on the user's local filesystem whose* contents we want to stream.*- * @return A (ReadableStream, size) tuple. The {@link ReadableStream} can be- * used to read the files contents in a streaming manner. The size value is the- * the size of the file that we'll be reading from disk.+ * @return A ({@link Response}, size) tuple.+ *+ * * The response contains the contents of the file. In particular, the `body`+ * {@link ReadableStream} property of this response can be used to read the+ * files contents in a streaming manner.+ *+ * * The size is the size of the file that we'll be reading from disk.*/export const readStream = async (path: string,-): Promise<{ stream: ReadableStream; size: number }> => {+): Promise<{ response: Response; size: number }> => {const req = new Request(`stream://read${path}`, {method: "GET",});@@ -37,7 +41,7 @@ export const readStream = async (`Got a numeric Content-Length when reading a stream. The response was ${res}`,);- return { stream: res.body, size };+ return { response: res, size };};/**