From ea433ee8cb558d47e92c6c44a0d1e0bfaf272fb2 Mon Sep 17 00:00:00 2001 From: Anatoli Kalbasin Date: Tue, 5 Nov 2024 16:19:06 +0100 Subject: [PATCH] encode hyperlinks Signed-off-by: Anatoli Kalbasin --- src/main/kotlin/org/zowe/zdevops/logic/DownloadOperation.kt | 6 ++++-- .../kotlin/org/zowe/zdevops/logic/SubmitJobOperation.kt | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/org/zowe/zdevops/logic/DownloadOperation.kt b/src/main/kotlin/org/zowe/zdevops/logic/DownloadOperation.kt index cf8555a..e82a05a 100644 --- a/src/main/kotlin/org/zowe/zdevops/logic/DownloadOperation.kt +++ b/src/main/kotlin/org/zowe/zdevops/logic/DownloadOperation.kt @@ -29,7 +29,8 @@ import org.zowe.zdevops.Messages import java.io.File import java.io.InputStream import java.io.StringWriter - +import java.net.URLEncoder +import java.nio.charset.StandardCharsets /** @@ -62,8 +63,9 @@ fun downloadDS( IOUtils.copy(downloadedDSN, writer, "UTF-8") val file = File("$workspace\\$dsn") file.writeText(writer.toString()) + val urlEncodedDsn = URLEncoder.encode(dsn, StandardCharsets.UTF_8.toString()) listener.logger.println(Messages.zdevops_declarative_DSN_downloaded_success( - HyperlinkNote.encodeTo("${jenkinsJobUrl}ws/$dsn/*view*/", dsn))) + HyperlinkNote.encodeTo("${jenkinsJobUrl}ws/$urlEncodedDsn/*view*/", dsn))) } /** diff --git a/src/main/kotlin/org/zowe/zdevops/logic/SubmitJobOperation.kt b/src/main/kotlin/org/zowe/zdevops/logic/SubmitJobOperation.kt index 8fd19bd..0586d1c 100644 --- a/src/main/kotlin/org/zowe/zdevops/logic/SubmitJobOperation.kt +++ b/src/main/kotlin/org/zowe/zdevops/logic/SubmitJobOperation.kt @@ -25,6 +25,8 @@ import org.zowe.zdevops.Messages import org.zowe.zdevops.utils.extractSubmitJobMessage import org.zowe.zdevops.utils.runMFTryCatchWrappedQuery import java.io.File +import java.net.URLEncoder +import java.nio.charset.StandardCharsets /** * Submits a z/OS job @@ -93,10 +95,11 @@ fun submitJobSync( val logPath = "$workspacePath/${finalResult.jobName}.${finalResult.jobId}" val file = File(logPath) file.writeText(fullLog) + val urlEncodedJobName = URLEncoder.encode(finalResult.jobName, StandardCharsets.UTF_8.toString()) listener.logger.println(Messages.zdevops_declarative_ZOSJobs_got_log( HyperlinkNote.encodeTo( linkBuilder(buildUrl, finalResult.jobName, finalResult.jobId), - "${finalResult.jobName}.${finalResult.jobId}" + "$urlEncodedJobName.${finalResult.jobId}" ) )) } else {