Skip to content

Commit

Permalink
Use license validator property enable. (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
CamaradeRoman committed Apr 3, 2024
1 parent c8f0765 commit c35893c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class ArtifactValidator private constructor(
val licenseValidatorProperties: LicenseValidatorPropertiesDTO
) {
fun validate(path: String, file: Path) =
if (file.inputStream().use { detectFileType(BufferedInputStream(it)) } == FileType.ZIP &&
if (licenseValidatorProperties.enabled &&
file.inputStream().use { detectFileType(BufferedInputStream(it)) } == FileType.ZIP &&
!ZipFile(file.toFile()).stream()
.filter { entry -> !entry.isDirectory && licenseValidatorProperties.pattern.matches(entry.name) }
.map { entry -> entry.name }
Expand Down Expand Up @@ -190,6 +191,7 @@ class ArtifactValidator private constructor(

companion object {
private const val BUFFER_SIZE = 524288

private enum class FileType {
PLAIN, ZIP, AR, TAR, TARGZ, TARXZ, RPM
}
Expand Down

0 comments on commit c35893c

Please sign in to comment.