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(