Manav Rathi 1 éve
szülő
commit
f2e352c344
1 módosított fájl, 3 hozzáadás és 1 törlés
  1. 3 1
      desktop/src/main/stream.ts

+ 3 - 1
desktop/src/main/stream.ts

@@ -30,12 +30,14 @@ export const registerStreamProtocol = () => {
     protocol.handle("stream", async (request: Request) => {
     protocol.handle("stream", async (request: Request) => {
         const url = request.url;
         const url = request.url;
         const { host, pathname } = new URL(url);
         const { host, pathname } = new URL(url);
+        // Convert e.g. "%20" to spaces.
+        const path = decodeURIComponent(pathname);
         switch (host) {
         switch (host) {
             /* stream://write/path/to/file */
             /* stream://write/path/to/file */
             /*          host-pathname----- */
             /*          host-pathname----- */
             case "write":
             case "write":
                 try {
                 try {
-                    await writeStream(pathname, request.body);
+                    await writeStream(path, request.body);
                     return new Response("", { status: 200 });
                     return new Response("", { status: 200 });
                 } catch (e) {
                 } catch (e) {
                     log.error(`Failed to write stream for ${url}`, e);
                     log.error(`Failed to write stream for ${url}`, e);