diff --git a/src/artifacts/pyinstaller/CArchiveMembers.ts b/src/artifacts/pyinstaller/CArchiveMembers.ts index 5b41d9142c0..6fe18321d54 100644 --- a/src/artifacts/pyinstaller/CArchiveMembers.ts +++ b/src/artifacts/pyinstaller/CArchiveMembers.ts @@ -129,74 +129,42 @@ export const projectPyzContainer = ( pathDialect: CarrierPathDialect, ): PyInstallerMember => { const { archive } = image; - const path = canonicalMemberPath(entry.name, pathDialect); - const byteOffset = sourceByteOffset(entry, archiveStart); - const limitations: string[] = []; - if (archive.kind === "opaque") - return { - entry: projectEntry({ - path, - declaredSize: entry.uncompressedSize, - compressedSize: entry.compressedSize, - byteOffset, - // Legacy encryption applies to inner payloads, never the PYZ image. - encrypted: false, - limitations: [ - ...limitations, - archive.limitation, - ...(encrypted - ? ["PYZ entries are encrypted and were not decoded."] - : []), - ], - adapterKey: `carchive:${String(entry.index)}:${entry.name}`, - formatMetadata: cArchiveEntryMetadata( - entry, - undefined, - archive, - encrypted, - ), - }), - read: - entry.compressionFlag === 1 - ? { - kind: "pyz", - handle: image.handle, - offset: image.start, - length: entry.uncompressedSize, - compressed: false, - uncompressedSize: entry.uncompressedSize, - header: undefined, - } - : { - kind: "carchive", - archiveStart, - source: entry, - header: undefined, - }, - }; + const opaque = archive.kind === "opaque"; + const container = projectEntry({ + path: canonicalMemberPath(entry.name, pathDialect), + kind: opaque ? "file" : "directory", + declaredSize: entry.uncompressedSize, + compressedSize: entry.compressedSize, + byteOffset: sourceByteOffset(entry, archiveStart), + // Legacy encryption applies to inner payloads, never the PYZ image. + encrypted: false, + limitations: [ + opaque ? archive.limitation : `PyInstaller PYZ sha256 ${archive.sha256}.`, + ...(encrypted ? ["PYZ entries are encrypted and were not decoded."] : []), + ], + adapterKey: `carchive:${String(entry.index)}:${entry.name}`, + formatMetadata: cArchiveEntryMetadata(entry, undefined, archive, encrypted), + }); + if (!opaque) return { entry: container, read: undefined }; return { - entry: projectEntry({ - path, - kind: "directory", - declaredSize: entry.uncompressedSize, - compressedSize: entry.compressedSize, - byteOffset, - limitations: [ - ...limitations, - `PyInstaller PYZ sha256 ${archive.sha256}.`, - ...(encrypted - ? ["PYZ entries are encrypted and were not decoded."] - : []), - ], - adapterKey: `carchive:${String(entry.index)}:${entry.name}`, - formatMetadata: cArchiveEntryMetadata( - entry, - undefined, - archive, - encrypted, - ), - }), - read: undefined, + entry: container, + read: + entry.compressionFlag === 1 + ? { + kind: "pyz", + handle: image.handle, + offset: image.start, + length: entry.uncompressedSize, + compressed: false, + uncompressedSize: entry.uncompressedSize, + header: undefined, + } + : { + kind: "carchive", + archiveStart, + source: entry, + header: undefined, + }, }; };