mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
fix: optimized asar paths checks (#26024)
* fix: optimized asar paths checks * fix: ensuring the linter is happy
This commit is contained in:
@@ -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));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user