Due to a scheduled upgrade to version 14.10, GitLab will be unavailabe on Monday 30.05., from 19:00 until 20:00.

Commit 32ac836b authored by Thomas Bernhart's avatar Thomas Bernhart
Browse files

Remove null check from ingestBinaries

parent b97ef272
Pipeline #22050 passed with stages
in 3 minutes and 53 seconds
......@@ -92,20 +92,18 @@ class Ingester(
@Throws(FcrepoOperationFailedException::class, IOException::class, MissingMimeTypeException::class, SftpClientException::class, URISyntaxException::class)
private fun ingestBinaries(
sftpLocators: List<Pair<String, String?>>,
sftpLocators: List<Pair<String, String>>,
rdfHandler: RdfHandler,
transaction: FedoraTransactionClient
) {
sftpLocators.forEach {
val digitalInstantiationUrl = it.first
it.second.let { path ->
if (path != null) {
sftpClient.open(File(path)).use { stream ->
val binaryUri = "$digitalInstantiationUrl/${Service.BINARY_FILE_URI_PATH}"
val mimeType = rdfHandler.getMimeType(digitalInstantiationUrl)
log.info("Ingesting binary $binaryUri with mime type $mimeType.")
transaction.createOrUpdateBinaryResource(URI(binaryUri), stream, mimeType)
}
sftpClient.open(File(path)).use { stream ->
val binaryUri = "$digitalInstantiationUrl/${Service.BINARY_FILE_URI_PATH}"
val mimeType = rdfHandler.getMimeType(digitalInstantiationUrl)
log.info("Ingesting binary $binaryUri with mime type $mimeType.")
transaction.createOrUpdateBinaryResource(URI(binaryUri), stream, mimeType)
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment