From 5f0103682b91dc0d966aa38bd1e56f0b9442b96a Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Tue, 30 Apr 2024 10:24:41 +0530 Subject: [PATCH] entries --- web/apps/photos/src/utils/native-stream.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/web/apps/photos/src/utils/native-stream.ts b/web/apps/photos/src/utils/native-stream.ts index 1ecae0624..8ada6070c 100644 --- a/web/apps/photos/src/utils/native-stream.ts +++ b/web/apps/photos/src/utils/native-stream.ts @@ -18,7 +18,7 @@ import type { Electron, ZipItem } from "@/next/types/ipc"; * To avoid accidentally invoking it in a non-desktop app context, it requires * the {@link Electron} object as a parameter (even though it doesn't use it). * - * @param pathOrZipEntry Either the path on the file on the user's local file + * @param pathOrZipItem Either the path on the file on the user's local file * system whose contents we want to stream. Or a tuple containing the path to a * zip file and the name of the entry within it. * @@ -35,20 +35,18 @@ import type { Electron, ZipItem } from "@/next/types/ipc"; */ export const readStream = async ( _: Electron, - pathOrZipEntry: string | ZipItem, + pathOrZipItem: string | ZipItem, ): Promise<{ response: Response; size: number; lastModifiedMs: number }> => { let url: URL; - if (typeof pathOrZipEntry == "string") { - url = new URL(`stream://read${pathOrZipEntry}`); + if (typeof pathOrZipItem == "string") { + url = new URL(`stream://read${pathOrZipItem}`); } else { - const [zipPath, entryName] = pathOrZipEntry; + const [zipPath, entryName] = pathOrZipItem; url = new URL(`stream://read${zipPath}`); url.hash = entryName; } - const req = new Request(url, { - method: "GET", - }); + const req = new Request(url, { method: "GET" }); const res = await fetch(req); if (!res.ok)