From 31098400adc67876945bd16413c0d9b82730ec65 Mon Sep 17 00:00:00 2001 From: Gordon Martin Date: Mon, 13 Nov 2023 13:53:46 -0800 Subject: [PATCH] BL-12852 Deal with + in sub filenames --- package.json | 2 +- src/main/index.ts | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index b72e97b..f649f94 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bloompub-viewer", - "version": "1.0.3", + "version": "1.0.4", "author": "Bloom Devs", "description": "Viewer for Bloom Digital books", "license": "MIT", diff --git a/src/main/index.ts b/src/main/index.ts index b9e140a..2e65095 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -75,11 +75,12 @@ let currentFolder: string; function convertUrlToPath(requestUrl: string): string { // console.log(`convertUrlToPath: requestUrl=${requestUrl}`); - const bloomPlayerOrigin = "bpub://bloom-player/"; - const baseUrl = decodeURI(requestUrl); + const urlPrefix = "bpub://"; + const bloomPlayerOrigin = urlPrefix + "bloom-player/"; + const baseUrl = decodeURIComponent(requestUrl); const urlPath = baseUrl.startsWith(bloomPlayerOrigin) - ? baseUrl.substr(bloomPlayerOrigin.length) - : baseUrl.substr(7); // not from same origin? shouldn't happen. + ? baseUrl.substring(bloomPlayerOrigin.length) + : baseUrl.substring(urlPrefix.length); // not from same origin? shouldn't happen. const playerFolder = process.env.NODE_ENV === "development" ? Path.normalize(