Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #7332 - saving vis with % in name causes error #7701

Merged
merged 7 commits into from
Aug 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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