mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-25 07:57:12 -07:00
Fix slashes in the zip file.
This commit is contained in:
parent
49e69d0964
commit
6a08d3caa8
2 changed files with 3 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue