Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for windows path resolution issue introduced by adm-zip update #14

Merged
merged 3 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 40 additions & 29 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/decrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ export function getAppResourcesMap(rendererBuffer: Buffer, key?: string) {
getData: () => any
}) => {
if (zip.isDirectory === false) {
appResourcesMap.set(zip.entryName.toString(), zip.getData())
//Ensure that entries have forward slashes
//Windows gets backslashes that have to be converted
const entryName = zip.entryName.toString().replaceAll('\\', '/')
appResourcesMap.set(entryName, zip.getData())
}
}
)
Expand Down
1 change: 1 addition & 0 deletions src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export function runRenderer(scheme = appProtocol) {
protocol.registerBufferProtocol(scheme, (request, callback) => {
try {
let url = request.url.replace(`${scheme}://apps/`, '')
url = url.replaceAll('\\', '/') //Ensure we match the entries produced in the map
url = url.split(/#|\?/)[0]
callback({
data: appResourcesMap.get(url),
Expand Down
Loading