@@ -42,6 +42,8 @@ class LocalFileToUssDirMoverFactory : OperationRunnerFactory {
4242 */
4343class LocalFileToUssDirMover (val dataOpsManager : DataOpsManager ) : AbstractFileMover() {
4444
45+ private val sourceContentType = " text/plain; charset=UTF-8"
46+
4547 /* *
4648 * Checks that source is local file, dest is uss directory, and destination
4749 * file is located on remote system (by fetching its attributes).
@@ -78,16 +80,19 @@ class LocalFileToUssDirMover(val dataOpsManager: DataOpsManager) : AbstractFileM
7880
7981 val pathToFile = destAttributes.path + " /" + newName
8082
81- val contentToUpload = sourceFile.contentsToByteArray().toMutableList ()
83+ val currentFileContent = sourceFile.contentsToByteArray()
8284 val xIBMDataType =
8385 if (sourceFile.fileType.isBinary) XIBMDataType (XIBMDataType .Type .BINARY ) else XIBMDataType (XIBMDataType .Type .TEXT )
8486
87+ val contentToUpload = if (sourceFile.fileType.isBinary) currentFileContent else
88+ currentFileContent.toString(sourceFile.charset).encodeToByteArray()
8589
8690 val response = apiWithBytesConverter<DataAPI >(destConnectionConfig).writeToUssFile(
8791 authorizationToken = destConnectionConfig.authToken,
8892 filePath = FilePath (pathToFile),
89- body = contentToUpload.toByteArray(),
90- xIBMDataType = xIBMDataType
93+ body = contentToUpload,
94+ xIBMDataType = xIBMDataType,
95+ contentType = sourceContentType
9196 ).applyIfNotNull(progressIndicator) { indicator ->
9297 cancelByIndicator(indicator)
9398 }.execute()
0 commit comments