Skip to content

Commit 114e2a1

Browse files
Put the cluster_uuid in quotes (#83987) (#84329)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
1 parent f5cedd1 commit 114e2a1

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

x-pack/plugins/monitoring/public/lib/get_safe_for_external_link.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('getSafeForExternalLink', () => {
5151
location
5252
)
5353
).toBe(
54-
`#/overview?_g=(cluster_uuid:NDKg6VXAT6-TaGzEK2Zy7g,filters:!(),refreshInterval:(pause:!t,value:10000),time:(from:'2017-09-07T20:12:04.011Z',to:'2017-09-07T20:18:55.733Z'))`
54+
`#/overview?_g=(cluster_uuid:'NDKg6VXAT6-TaGzEK2Zy7g',filters:!(),refreshInterval:(pause:!t,value:10000),time:(from:'2017-09-07T20:12:04.011Z',to:'2017-09-07T20:18:55.733Z'))`
5555
);
5656
});
5757

@@ -68,7 +68,7 @@ describe('getSafeForExternalLink', () => {
6868
location
6969
)
7070
).toBe(
71-
`#/overview?_g=(filters:!(),refreshInterval:(pause:!t,value:10000),time:(from:'2017-09-07T20:12:04.011Z',to:'2017-09-07T20:18:55.733Z'),cluster_uuid:NDKg6VXAT6-TaGzEK2Zy7g)`
71+
`#/overview?_g=(filters:!(),refreshInterval:(pause:!t,value:10000),time:(from:'2017-09-07T20:12:04.011Z',to:'2017-09-07T20:18:55.733Z'),cluster_uuid:'NDKg6VXAT6-TaGzEK2Zy7g')`
7272
);
7373
});
7474
});

x-pack/plugins/monitoring/public/lib/get_safe_for_external_link.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@ export function getSafeForExternalLink(
2424

2525
let newGlobalState = globalStateExecResult[1];
2626
Object.keys(globalState).forEach((globalStateKey) => {
27+
let value = globalState[globalStateKey];
28+
if (globalStateKey === 'cluster_uuid') {
29+
value = `'${value}'`;
30+
}
2731
const keyRegExp = new RegExp(`${globalStateKey}:([^,]+)`);
2832
const execResult = keyRegExp.exec(newGlobalState);
2933
if (execResult && execResult.length) {
30-
newGlobalState = newGlobalState.replace(
31-
execResult[0],
32-
`${globalStateKey}:${globalState[globalStateKey]}`
33-
);
34+
newGlobalState = newGlobalState.replace(execResult[0], `${globalStateKey}:${value}`);
3435
} else {
35-
newGlobalState += `,${globalStateKey}:${globalState[globalStateKey]}`;
36+
newGlobalState += `,${globalStateKey}:${value}`;
3637
}
3738
});
3839

0 commit comments

Comments
 (0)