Skip to content

Commit

Permalink
chore: add trailing slashes to printed urls (#1405)
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
  • Loading branch information
tolusha authored Jul 13, 2021
1 parent 0cf7a4e commit ed32fa3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/tasks/che.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { KubeHelper } from '../api/kube'
import { OpenShiftHelper } from '../api/openshift'
import { VersionHelper } from '../api/version'
import { CHE_OPERATOR_SELECTOR, DOC_LINK, DOC_LINK_RELEASE_NOTES, OUTPUT_SEPARATOR } from '../constants'
import { base64Decode, newError } from '../util'
import { addTrailingSlash, base64Decode, newError } from '../util'

import { KubeTasks } from './kube'

Expand Down Expand Up @@ -714,15 +714,15 @@ export class CheTasks {
const cheConfigMap = await this.kube.getConfigMap('che', flags.chenamespace)
if (cheConfigMap && cheConfigMap.data) {
if (cheConfigMap.data.CHE_WORKSPACE_PLUGIN__REGISTRY__URL) {
messages.push(`Plug-in Registry : ${cheConfigMap.data.CHE_WORKSPACE_PLUGIN__REGISTRY__URL}`)
messages.push(`Plug-in Registry : ${addTrailingSlash(cheConfigMap.data.CHE_WORKSPACE_PLUGIN__REGISTRY__URL)}`)
}
if (cheConfigMap.data.CHE_WORKSPACE_DEVFILE__REGISTRY__URL) {
messages.push(`Devfile Registry : ${cheConfigMap.data.CHE_WORKSPACE_DEVFILE__REGISTRY__URL}`)
messages.push(`Devfile Registry : ${addTrailingSlash(cheConfigMap.data.CHE_WORKSPACE_DEVFILE__REGISTRY__URL)}`)
}
messages.push(OUTPUT_SEPARATOR)

if (cheConfigMap.data.CHE_KEYCLOAK_AUTH__SERVER__URL) {
messages.push(`Identity Provider URL : ${cheConfigMap.data.CHE_KEYCLOAK_AUTH__SERVER__URL}`)
messages.push(`Identity Provider URL : ${addTrailingSlash(cheConfigMap.data.CHE_KEYCLOAK_AUTH__SERVER__URL)}`)
}
if (ctx.identityProviderUsername && ctx.identityProviderPassword) {
messages.push(`Identity Provider login : "${ctx.identityProviderUsername}:${ctx.identityProviderPassword}".`)
Expand Down
7 changes: 7 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,10 @@ export async function getDistribution(): Promise<string | undefined> {
}
return
}

export function addTrailingSlash(url: string): string {
if (url.endsWith('/')) {
return url
}
return url + '/'
}

0 comments on commit ed32fa3

Please sign in to comment.