From 58c10796a1291e8b5be6e55e11c514952990941d Mon Sep 17 00:00:00 2001 From: Waldemar Reusch Date: Fri, 28 Apr 2023 16:59:06 +0200 Subject: [PATCH] fix: fix broken jar Many tools will handle zipfiles which lack directory entries just fine, others will not. Looks like the JDKs JAR libs are not handling it well. This commit will make sure to create folder entries. --- src/bin/tools/jar.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bin/tools/jar.ts b/src/bin/tools/jar.ts index 962f994e..33fdf2df 100644 --- a/src/bin/tools/jar.ts +++ b/src/bin/tools/jar.ts @@ -48,8 +48,12 @@ export async function jarStream({ groupId, artifactId, version, asyncPathGenerat for await (const entry of asyncPathGeneratorFn()) { if ("buffer" in entry) { zipFile.addBuffer(entry.buffer, entry.zipPath); - } else if ("fsPath" in entry && !entry.fsPath.endsWith(sep)) { - zipFile.addFile(entry.fsPath, entry.zipPath); + } else if ("fsPath" in entry) { + if (entry.fsPath.endsWith(sep)) { + zipFile.addEmptyDirectory(entry.zipPath); + } else { + zipFile.addFile(entry.fsPath, entry.zipPath); + } } }