mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Correct display of warning header
Elasticsearch produces warning headers for the use of deprecated features. These warning headers can contain commas which breaks the splitting of multiple values on commas. Upstream Elasticsearch has changed the warning headers to be specification compliant so that these headers can be safely split (the warning text and warning date must be quoted, so splits should only occur on commas that are not contained in quotes). Additionally, the upstream change includes additional details that are not needed for display in Console (a warning code, the Elasticsearch version that produced the warning, and the warning date). This commit corrects the splitting logic in Console to only split on commas not contained in quotes, and to extract the warning text from each warning header.
This commit is contained in:
parent
15d1e7c8cf
commit
02896eaed7
1 changed files with 7 additions and 2 deletions
|
@ -178,8 +178,13 @@ export function initializeInput($el, $actionsEl, $copyAsCurlEl, output) {
|
|||
|
||||
var warnings = xhr.getResponseHeader("warning");
|
||||
if (warnings) {
|
||||
warnings = _.map(warnings.split(", "), function (warning) {
|
||||
return "#! Deprecation: " + warning;
|
||||
// pattern for valid warning header
|
||||
var re = /\d{3} [^ ]+ \"([^"]*)\"( \"[^"]*\")/
|
||||
// split on any comma that is followed by an even number of quotes
|
||||
warnings = _.map(warnings.split(/, (?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/), function (warning) {
|
||||
var match = re.exec(warning)
|
||||
// extract the actual warning
|
||||
return "#! Deprecation: " + match[1]
|
||||
});
|
||||
value = warnings.join("\n") + "\n" + value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue