Skip to content

Commit

Permalink
encode hyperlinks
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoli Kalbasin <[email protected]>
  • Loading branch information
callbacksin committed Nov 5, 2024
1 parent c8e9dd5 commit ea433ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/main/kotlin/org/zowe/zdevops/logic/DownloadOperation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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


/**
Expand Down Expand Up @@ -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)))
}

/**
Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/org/zowe/zdevops/logic/SubmitJobOperation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ea433ee

Please sign in to comment.