fix: optimized asar paths checks (#26024)
* fix: optimized asar paths checks * fix: ensuring the linter is happy
This commit is contained in:
parent
aa157c3f05
commit
d4191c4a26
1 changed files with 3 additions and 0 deletions
|
@ -37,6 +37,8 @@ const getOrCreateArchive = (archivePath: string) => {
|
|||
return newArchive;
|
||||
};
|
||||
|
||||
const asarRe = /\.asar/i;
|
||||
|
||||
// Separate asar package's path from full path.
|
||||
const splitPath = (archivePathOrBuffer: string | Buffer) => {
|
||||
// Shortcut for disabled asar.
|
||||
|
@ -48,6 +50,7 @@ const splitPath = (archivePathOrBuffer: string | Buffer) => {
|
|||
archivePath = archivePathOrBuffer.toString();
|
||||
}
|
||||
if (typeof archivePath !== 'string') return { isAsar: <const>false };
|
||||
if (!asarRe.test(archivePath)) return { isAsar: <const>false };
|
||||
|
||||
return asar.splitPath(path.normalize(archivePath));
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue