зеркало из https://github.com/electron/electron.git
fix: internalModuleReadJSON for unpacked JSON (#26749)
This commit is contained in:
Родитель
c2909a3b8d
Коммит
efca7007b6
|
@ -689,7 +689,8 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
|||
if (info.size === 0) return ['', false];
|
||||
if (info.unpacked) {
|
||||
const realPath = archive.copyFileOut(filePath);
|
||||
return fs.readFileSync(realPath, { encoding: 'utf8' });
|
||||
const str = fs.readFileSync(realPath, { encoding: 'utf8' });
|
||||
return [str, str.length > 0];
|
||||
}
|
||||
|
||||
logASARAccess(asarPath, filePath, info.offset);
|
||||
|
|
|
@ -1444,7 +1444,8 @@ describe('asar package', function () {
|
|||
|
||||
it('reads a normal file with unpacked files', function () {
|
||||
const p = path.join(asarDir, 'unpack.asar', 'a.txt');
|
||||
expect(internalModuleReadJSON(p).toString().trim()).to.equal('a');
|
||||
const [s, c] = internalModuleReadJSON(p);
|
||||
expect([s.toString().trim(), c]).to.eql(['a', true]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче