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: allow paths to asar archives to contain the .asar extension in directories #20342
Conversation
@zcbenz we have an issue with a customer, who has the app installed to Loading a node module, which is located in
|
@zcbenz I am not sure what's the best solution. Ideally only files would be treated as ASAR archives, not directories. But we would need to check the type every time we parse the path, which would be inefficient. |
@miniak I think it is not just a problem with reading file under The
Checking type every time seems to be only correct solution. We can probably use caching to avoid performance problem: if (cachedArchives.has(archivePath))
isAsar = true
else if (cacedFolders.has(archivePath))
isAsar = false
else {
if (fs.isFolder(archivePath)) {
cacedFolders.add(archivePath)
isAsar = false
} else
isAsar = true
} we would have problems when user replaces a folder with a real asar archive though, but I think we don't need to be prepared for that. |
0d115ce
to
fe7ab65
Compare
fe7ab65
to
3da5106
Compare
@zcbenz I've added the check for directories with caching. I've also moved some of the parsing code to native to eliminate code duplication. |
c61506f
to
c2cf9a8
Compare
c2cf9a8
to
3b80ed5
Compare
3b80ed5
to
0eb9c4d
Compare
0eb9c4d
to
dae6e34
Compare
Description of Change
There is an issue with the code parsing paths to determine whether it's an ASAR archive:
electron/lib/common/asar.js
Lines 43 to 73 in 0653e31
It can handle
//some/path.asar/to/archive.asar/then/internal.file
, however if the file ends up being mapped to//some/path.asar/to/archive.asar.unpacked/then/internal.file
, it incorrectly returns:This PR:
splitPath
implementation to native code reusingasar::GetAsarArchivePath()
to eliminate code duplication.asar
extension an archive (the results of is directory check need to be cached for performance reasons)Checklist
npm test
passesRelease Notes
Notes: Fixed parsing of paths with
.asar
in directory name extensions.