Skip to content

Commit 942bcd8

Browse files
authored
Do not publish checksums for maven-metadata (#258)
1 parent 4ad0a51 commit 942bcd8

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

nmcp-tasks/src/main/kotlin/nmcp/transport/publishFileByFile.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private fun publishGav(
121121
val newName = newArtifact.fileName()
122122
renamedFiles.add(FileWithPath(it.file, "$gavPath/${newName}"))
123123

124-
if (newArtifact.extension.substringAfterLast('.') !in checksums) {
124+
if (newArtifact.extension.substringAfterLast('.') !in setOf("md5", "sha1", "sha256", "sha512")) {
125125
snapshotVersions.add(
126126
VersionMetadata.SnapshotVersion(
127127
classifier = newArtifact.classifier,
@@ -130,6 +130,8 @@ private fun publishGav(
130130
updated = lastUpdated.asTimestamp(false),
131131
),
132132
)
133+
} else {
134+
// Ignore the checksums in the list of files
133135
}
134136
}
135137

@@ -220,9 +222,6 @@ private fun publishGav(
220222

221223
val bytes = encodeToXml(newArtifactMetadata).toByteArray()
222224
transport.put(artifactMetadataPath, bytes)
223-
checksums.forEach {
224-
transport.put("$artifactMetadataPath.$it", bytes.digest(it.uppercase()))
225-
}
226225
}
227226

228227

@@ -247,8 +246,6 @@ internal fun Instant.asTimestamp(withDot: Boolean): String {
247246
)
248247
}
249248

250-
internal val checksums = setOf("md5", "sha1", "sha256", "sha512")
251-
252249
internal inline fun <reified T> encodeToXml(t: T): String {
253250
return xml.encodeToString(t)
254251
}

0 commit comments

Comments
 (0)