You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ML] Fix custom URLs processing for security app (#76957)
* [ML] fix custom urls processing for security app
* [ML] improve query string parsing
* [ML] remove escaping with !, adjust a unit test for security app
* [ML] unit test
* [ML] unit test
"discover#/?_g=(time:(from:'$earliest$',mode:absolute,to:'$latest$'))&_a=(index:bf6e5860-9404-11e8-8d4c-593f69c47267,query:(language:kuery,query:'airline:\"$airline$\" and odd:field,name : $odd:field,name$'))",
"discover#/?_g=(time:(from:'2017-02-09T15:10:00.000Z',mode:absolute,to:'2017-02-09T17:15:00.000Z'))&_a=(index:bf6e5860-9404-11e8-8d4c-593f69c47267,query:(language:kuery,query:'airline:\"%3C%3E%3A%3B%5B%7D%5C%22)\" and odd:field,name:>:&12<''))"
274
+
);
275
+
});
276
+
277
+
test('correctly encodes special characters inside of a query string',()=>{
278
+
consttestUrl={
279
+
url_name: 'Show dashboard',
280
+
time_range: 'auto',
281
+
url_value: `dashboards#/view/351de820-f2bb-11ea-ab06-cb93221707e9?_a=(filters:!(),query:(language:kuery,query:'at@name:"$at@name$" and singlequote!'name:"$singlequote!'name$"'))&_g=(filters:!(),time:(from:'$earliest$',mode:absolute,to:'$latest$'))`,
282
+
};
283
+
284
+
consttestRecord={
285
+
job_id: 'spec-char',
286
+
result_type: 'record',
287
+
probability: 0.0028099428534745633,
288
+
multi_bucket_impact: 5,
289
+
record_score: 49.00785814424704,
290
+
initial_record_score: 49.00785814424704,
291
+
bucket_span: 900,
292
+
detector_index: 0,
293
+
is_interim: false,
294
+
timestamp: 1549593000000,
295
+
partition_field_name: 'at@name',
296
+
partition_field_value: "contains a ' quote",
297
+
function: 'mean',
298
+
function_description: 'mean',
299
+
typical: [1993.2657340111837],
300
+
actual: [1808.3334418402778],
301
+
field_name: 'metric%$£&!{(]field',
302
+
influencers: [
303
+
{
304
+
influencer_field_name: "singlequote'name",
305
+
influencer_field_values: ["contains a ' quote"],
306
+
},
307
+
{
308
+
influencer_field_name: 'at@name',
309
+
influencer_field_values: ["contains a ' quote"],
310
+
},
311
+
],
312
+
"singlequote'name": ["contains a ' quote"],
313
+
'at@name': ["contains a ' quote"],
314
+
earliest: '2019-02-08T00:00:00.000Z',
315
+
latest: '2019-02-08T23:59:59.999Z',
316
+
};
317
+
318
+
expect(getUrlForRecord(testUrl,testRecord)).toBe(
319
+
`dashboards#/view/351de820-f2bb-11ea-ab06-cb93221707e9?_a=(filters:!(),query:(language:kuery,query:'at@name:"contains%20a%20!'%20quote" AND singlequote!'name:"contains%20a%20!'%20quote"'))&_g=(filters:!(),time:(from:'2019-02-08T00:00:00.000Z',mode:absolute,to:'2019-02-08T23:59:59.999Z'))`
0 commit comments