@@ -22,16 +22,20 @@ const addEpochTimestamp = (jsonObject: {metadata: ObjectMeta; workflow?: Workflo
2222} ;
2323
2424export const ProcessURL = ( url : string , jsonObject : any ) => {
25+ /* decode url string to apply templating */
26+ const decodedUrl = decodeURI ( url ) ;
2527 addEpochTimestamp ( jsonObject ) ;
2628 /* replace ${} from input url with corresponding elements from object
2729 return null if element is not found*/
28- return url . replace ( / \$ { [ ^ } ] * } / g, x => {
29- const res = x
30- . replace ( / [ $ { } ] + / g, '' )
31- . split ( '.' )
32- . reduce ( ( p : any , c : string ) => ( p && p [ c ] ) || null , jsonObject ) ;
33- return res ;
34- } ) ;
30+ return encodeURI (
31+ decodedUrl . replace ( / \$ { [ ^ } ] * } / g, x => {
32+ const res = x
33+ . replace ( / [ $ { } ] + / g, '' )
34+ . split ( '.' )
35+ . reduce ( ( p : any , c : string ) => ( p && p [ c ] ) || null , jsonObject ) ;
36+ return res ;
37+ } )
38+ ) ;
3539} ;
3640
3741export const Links = ( { scope, object, button} : { scope : string ; object : { metadata : ObjectMeta ; workflow ?: Workflow ; status ?: any } ; button ?: boolean } ) => {
@@ -47,7 +51,7 @@ export const Links = ({scope, object, button}: {scope: string; object: {metadata
4751 } , [ ] ) ;
4852
4953 const formatUrl = ( url : string ) => {
50- return encodeURI ( ProcessURL ( decodeURI ( url ) , object ) ) ;
54+ return ProcessURL ( url , object ) ;
5155 } ;
5256
5357 const openLink = ( url : string ) => {
0 commit comments