Commit d9c626f1 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Add transformation for illegal characters in filenames.

parent 0dadac04
Pipeline #23537 passed with stages
in 5 minutes and 1 second
......@@ -454,13 +454,14 @@ class KafkaTopology(private val settings: SettingsLoader) {
type: String,
originalIdentifierValue: String
): String? {
val transformedIdentifierValue = UtilityFunctions.transformIllegalFilenameCharacters(originalIdentifierValue)
for (extension in fileExtensions) {
val filePath = "$sftpBasePath/$recordSetId/$type/$originalIdentifierValue.$extension"
val filePath = "$sftpBasePath/$recordSetId/$type/$transformedIdentifierValue.$extension"
if (sftpClient.exists(filePath)) {
return "${Constant.sftpPathPrefix}$filePath"
}"No media file found. Tried $sftpBasePath/$recordSetId/$type/$originalIdentifierValue.{${fileExtensions.joinToString()}}")"No media file found. Tried $sftpBasePath/$recordSetId/$type/$transformedIdentifierValue.{${fileExtensions.joinToString()}}")
return null
package org.memobase
object UtilityFunctions {
* This utility function is used to replace illegal characters which cannot be used in filenames.
fun transformIllegalFilenameCharacters(input: String): String {
return input.replace("/", "_")
\ No newline at end of file
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