Skip to content

Commit

Permalink
Merge pull request elastic#7701 from ppisljar/fix/7332
Browse files Browse the repository at this point in the history
fix elastic#7332 - saving vis with % in name causes error
  • Loading branch information
Lee Drengenberg authored Aug 3, 2016
2 parents 7c710bf + 30fcbb6 commit 4469e88
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ app.service('savedVisualizations', function (Promise, es, kbnIndex, SavedVis, Pr
simple_query_string: {
query: searchString + '*',
fields: ['title^3', 'description'],
default_operator: 'AND'
default_operator: 'AND',
analyze_wildcard: true
}
}
};
Expand Down
6 changes: 5 additions & 1 deletion src/ui/public/utils/__tests__/slugify_id.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,22 @@ describe('slugifyId()', function () {
['test?test', 'test-questionmark-test'],
['test=test', 'test-equal-test'],
['test&test', 'test-ampersand-test'],
['test%test', 'test-percent-test'],
['test / test', 'test-slash-test'],
['test ? test', 'test-questionmark-test'],
['test = test', 'test-equal-test'],
['test & test', 'test-ampersand-test'],
['test % test', 'test-percent-test'],
['test / ^test', 'test-slash-^test'],
['test ? test', 'test-questionmark-test'],
['test = test', 'test-equal-test'],
['test & test', 'test-ampersand-test'],
['test % test', 'test-percent-test'],
['test/test/test', 'test-slash-test-slash-test'],
['test?test?test', 'test-questionmark-test-questionmark-test'],
['test&test&test', 'test-ampersand-test-ampersand-test'],
['test=test=test', 'test-equal-test-equal-test']
['test=test=test', 'test-equal-test-equal-test'],
['test%test%test', 'test-percent-test-percent-test']
];

_.each(fixtures, function (fixture) {
Expand Down
3 changes: 2 additions & 1 deletion src/ui/public/utils/slugify_id.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export default function (id) {
'/' : '-slash-',
'\\?' : '-questionmark-',
'\\&' : '-ampersand-',
'=' : '-equal-'
'=' : '-equal-',
'%' : '-percent-'
};
_.each(trans, function (val, key) {
let regex = new RegExp(key, 'g');
Expand Down
12 changes: 12 additions & 0 deletions test/functional/apps/visualize/_area_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ bdd.describe('visualize app', function describeIndexTests() {
bdd.describe('area charts', function indexPatternCreation() {
var vizName1 = 'Visualization AreaChart';

bdd.it('should save and load with special characters', function pageHeader() {
const vizNamewithSpecialChars = vizName1 + '/?&=%';
return PageObjects.visualize.saveVisualization(vizNamewithSpecialChars)
.then(function (message) {
PageObjects.common.debug(`Saved viz message = ${message}`);
expect(message).to.be(`Visualization Editor: Saved Visualization "${vizNamewithSpecialChars}"`);
})
.then(function testVisualizeWaitForToastMessageGone() {
return PageObjects.visualize.waitForToastMessageGone();
});
});

bdd.it('should save and load', function pageHeader() {
return PageObjects.visualize.saveVisualization(vizName1)
.then(function (message) {
Expand Down

0 comments on commit 4469e88

Please sign in to comment.