diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/archive/MetaArchive.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/archive/MetaArchive.kt index 69918dd4..539ce238 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/archive/MetaArchive.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/archive/MetaArchive.kt @@ -25,7 +25,7 @@ class MetaArchive(outputFile: File, val manifest: Manifest?) : Closeable { fun addFile(f: File, entryFile: File, path: String?) { val file = f.normalize() FileInputStream(file).use { inputStream -> - val actualPath = if (path != null) path + entryFile.path else entryFile.path + val actualPath = KFiles.fixSlashes(if (path != null) path + entryFile.path else entryFile.path) ZipArchiveEntry(actualPath).let { entry -> maybeAddEntry(entry) { addEntry(entry, inputStream) diff --git a/src/test/kotlin/com/beust/kobalt/VerifyKobaltZipTest.kt b/src/test/kotlin/com/beust/kobalt/VerifyKobaltZipTest.kt index c15e95d2..7966c8b5 100644 --- a/src/test/kotlin/com/beust/kobalt/VerifyKobaltZipTest.kt +++ b/src/test/kotlin/com/beust/kobalt/VerifyKobaltZipTest.kt @@ -3,6 +3,7 @@ package com.beust.kobalt import com.beust.kobalt.misc.KFiles import com.beust.kobalt.misc.kobaltLog import com.beust.kobalt.misc.warn +import org.assertj.core.api.Assertions.assertThat import org.testng.annotations.Test import java.io.File import java.io.FileInputStream @@ -38,6 +39,7 @@ class VerifyKobaltZipTest : KobaltTest() { val stream = JarInputStream(FileInputStream(zipFilePath)) var entry = stream.nextEntry while (entry != null) { + assertThat(entry.name).doesNotContain("\\") if (! entry.name.startsWith(root)) { throw AssertionError("Entries in the zip file should be under the directory $root") }