forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Ingest Pipelines] Fix serialization and deserialization of user inpu…
…t for "patterns" fields (elastic#94689) * updated serialization and deserialization behavior of dissect and gsub processors, also addded a test * also fix grok processor * pivot input checking to use JSON.stringify and JSON.parse Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
b7f9a41
commit c11ead8
Showing
6 changed files
with
142 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...pplication/components/pipeline_editor/components/processor_form/processors/shared.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { from, to } from './shared'; | ||
|
||
describe('shared', () => { | ||
describe('deserialization helpers', () => { | ||
// This is the text that will be passed to the text input | ||
test('to.escapeBackslashes', () => { | ||
// this input loaded from the server | ||
const input1 = 'my\ttab'; | ||
expect(to.escapeBackslashes(input1)).toBe('my\\ttab'); | ||
|
||
// this input loaded from the server | ||
const input2 = 'my\\ttab'; | ||
expect(to.escapeBackslashes(input2)).toBe('my\\\\ttab'); | ||
|
||
// this input loaded from the server | ||
const input3 = '\t\n\rOK'; | ||
expect(to.escapeBackslashes(input3)).toBe('\\t\\n\\rOK'); | ||
|
||
const input4 = `%{clientip} %{ident} %{auth} [%{@timestamp}] \"%{verb} %{request} HTTP/%{httpversion}\" %{status} %{size}`; | ||
expect(to.escapeBackslashes(input4)).toBe( | ||
'%{clientip} %{ident} %{auth} [%{@timestamp}] \\"%{verb} %{request} HTTP/%{httpversion}\\" %{status} %{size}' | ||
); | ||
}); | ||
}); | ||
|
||
describe('serialization helpers', () => { | ||
test('from.unescapeBackslashes', () => { | ||
// user typed in "my\ttab" | ||
const input1 = 'my\\ttab'; | ||
expect(from.unescapeBackslashes(input1)).toBe('my\ttab'); | ||
|
||
// user typed in "my\\tab" | ||
const input2 = 'my\\\\ttab'; | ||
expect(from.unescapeBackslashes(input2)).toBe('my\\ttab'); | ||
|
||
// user typed in "\t\n\rOK" | ||
const input3 = '\\t\\n\\rOK'; | ||
expect(from.unescapeBackslashes(input3)).toBe('\t\n\rOK'); | ||
|
||
const input5 = `%{clientip} %{ident} %{auth} [%{@timestamp}] \\"%{verb} %{request} HTTP/%{httpversion}\\" %{status} %{size}`; | ||
expect(from.unescapeBackslashes(input5)).toBe( | ||
`%{clientip} %{ident} %{auth} [%{@timestamp}] \"%{verb} %{request} HTTP/%{httpversion}\" %{status} %{size}` | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters