From 38969d6f45b2558d9517b4c180756d90c59b2f5e Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 1 May 2024 10:17:51 +0530 Subject: [PATCH] Fix zip reader --- desktop/src/main/stream.ts | 3 ++- web/apps/photos/src/utils/native-stream.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/desktop/src/main/stream.ts b/desktop/src/main/stream.ts index 3e27de12b4..30aebaa9da 100644 --- a/desktop/src/main/stream.ts +++ b/desktop/src/main/stream.ts @@ -48,7 +48,8 @@ export const registerStreamProtocol = () => { const { host, pathname, hash } = new URL(url); // Convert e.g. "%20" to spaces. const path = decodeURIComponent(pathname); - const hashPath = decodeURIComponent(hash); + // `hash` begins with a "#", slice that off. + const hashPath = decodeURIComponent(hash.slice(1)); switch (host) { case "read": return handleRead(path); diff --git a/web/apps/photos/src/utils/native-stream.ts b/web/apps/photos/src/utils/native-stream.ts index 8ada6070cd..8d93becfe0 100644 --- a/web/apps/photos/src/utils/native-stream.ts +++ b/web/apps/photos/src/utils/native-stream.ts @@ -42,7 +42,7 @@ export const readStream = async ( url = new URL(`stream://read${pathOrZipItem}`); } else { const [zipPath, entryName] = pathOrZipItem; - url = new URL(`stream://read${zipPath}`); + url = new URL(`stream://read-zip${zipPath}`); url.hash = entryName; }