Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: update dependency org.apache.commons:commons-compress to v1.26.0 #8302

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ versionsPlugin = "0.51.0"
asciidoctorj = "2.5.11"
asciidoctorjPdf = "2.3.13"
clikt = "4.2.2"
commonsCompress = "1.25.0"
commonsCompress = "1.26.0"
cvssCalculator = "1.4.2"
cyclonedx = "8.0.3"
diffUtils = "4.12"
Expand Down
10 changes: 4 additions & 6 deletions utils/common/src/main/kotlin/ArchiveUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ fun File.unpackTryAllTypes(targetDirectory: File, filter: (ArchiveEntry) -> Bool
* and all entries not matched by the given [filter].
*/
fun File.unpack7Zip(targetDirectory: File, filter: (ArchiveEntry) -> Boolean = { true }) {
SevenZFile(this).use { zipFile ->
SevenZFile.Builder().setFile(this).get().use { zipFile ->
val canonicalTargetDirectory = targetDirectory.canonicalFile

while (true) {
Expand Down Expand Up @@ -162,13 +162,13 @@ fun File.unpack7Zip(targetDirectory: File, filter: (ArchiveEntry) -> Boolean = {
* Unpack the [ByteArray] assuming it is a Zip archive, ignoring entries not matched by [filter].
*/
fun ByteArray.unpackZip(targetDirectory: File, filter: (ArchiveEntry) -> Boolean = { true }) =
ZipFile(SeekableInMemoryByteChannel(this)).unpack(targetDirectory, filter)
ZipFile.Builder().setSeekableByteChannel(SeekableInMemoryByteChannel(this)).get().unpack(targetDirectory, filter)

/**
* Unpack the [File] assuming it is a Zip archive ignoring all entries not matched by [filter].
*/
fun File.unpackZip(targetDirectory: File, filter: (ArchiveEntry) -> Boolean = { true }) =
ZipFile(this).unpack(targetDirectory, filter)
ZipFile.Builder().setFile(this).get().unpack(targetDirectory, filter)

/**
* Unpack the [ZipFile]. In contrast to [InputStream.unpackZip] this properly parses the ZIP's central directory, see
Expand Down Expand Up @@ -258,9 +258,7 @@ fun InputStream.unpackZip(targetDirectory: File) =
fun InputStream.unpackTar(targetDirectory: File, filter: (ArchiveEntry) -> Boolean = { true }) =
TarArchiveInputStream(this).unpack(
targetDirectory,
{ entry ->
(entry as TarArchiveEntry).isDirectory || !entry.isFile || File(entry.name).isAbsolute || !filter(entry)
},
{ entry -> !(entry as TarArchiveEntry).isFile || File(entry.name).isAbsolute || !filter(entry) },
{ entry -> (entry as TarArchiveEntry).mode }
)

Expand Down
Loading