π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
URL encode
Manav Rathide4aa3a6cac1
diff --git a/desktop/src/main/stream.ts b/desktop/src/main/stream.tsindex f1000c6bde..06c6e5fe93 100644--- a/desktop/src/main/stream.ts+++ b/desktop/src/main/stream.ts@@ -45,19 +45,15 @@ export const registerStreamProtocol = () => {// stream://write/path/to/file#/path/to/another/file// host[pathname----] [pathname-2---------]//- const { host, pathname, hash } = new URL(url);- // Convert e.g. "%20" to spaces.- const path = decodeURIComponent(pathname);- // `hash` begins with a "#", slice that off.- const hashPath = decodeURIComponent(hash.slice(1));- log.debug(- () => `[stream] ${host} ${path}${hashPath ? "::" + hashPath : ""}`,- );+ const { host, searchParams } = new URL(url);+ const path = ensure(searchParams.get("path"));+ const path2 = searchParams.get("path2") ?? undefined;+ log.debug(() => `[stream] ${host} ${path}${path2 ? "::" + path2 : ""}`);switch (host) {case "read":return handleRead(path);case "read-zip":- return handleReadZip(path, hashPath);+ return handleReadZip(path, ensure(path2));case "write":return handleWrite(path, request);default:diff --git a/web/apps/photos/src/utils/native-stream.ts b/web/apps/photos/src/utils/native-stream.tsindex b20cb9290a..73c3522ede 100644--- a/web/apps/photos/src/utils/native-stream.ts+++ b/web/apps/photos/src/utils/native-stream.ts@@ -39,11 +39,12 @@ export const readStream = async (): Promise<{ response: Response; size: number; lastModifiedMs: number }> => {let url: URL;if (typeof pathOrZipItem == "string") {- url = new URL(`stream://read${encodeURIComponent(pathOrZipItem)}`);+ const params = new URLSearchParams({ path: pathOrZipItem });+ url = new URL(`stream://read?${params.toString()}`);} else {const [zipPath, entryName] = pathOrZipItem;- url = new URL(`stream://read-zip${encodeURIComponent(zipPath)}`);- url.hash = entryName;+ const params = new URLSearchParams({ path: zipPath, path2: entryName });+ url = new URL(`stream://read-zip?${params.toString()}`);}const req = new Request(url, { method: "GET" });