Added escape and unescape for the strings used in query tool and new connection support. Fixes #5899.

This commit is contained in:
Khushboo Vashi 2020-10-12 16:20:33 +05:30 committed by Akshay Joshi
parent b11a0d50e6
commit 49b139bb75
3 changed files with 12 additions and 12 deletions

View File

@ -208,7 +208,7 @@ let NewConnectionDialog = {
let is_create_connection = true;
handler.gridView.connection_list.forEach(function(connection_data){
handler.gridView.connection_list.forEach(function(connection_data) {
if(parseInt(connection_data['server']) == newConnCollectionModel['server']
&& parseInt(connection_data['database']) == newConnCollectionModel['database']
&& connection_data['user'] == newConnCollectionModel['user'] && connection_data['role'] == newConnCollectionModel['role']) {
@ -225,17 +225,17 @@ let NewConnectionDialog = {
if(!is_create_connection) {
let errmsg = 'Connection with this configuration already present.';
Alertify.info(errmsg);
}else {
} else {
let connection_details = {
'server_group': handler.gridView.handler.url_params.sgid,
'server': newConnCollectionModel['server'],
'database': newConnCollectionModel['database'],
'title': tab_title,
'title': _.escape(tab_title),
'user': newConnCollectionModel['user'],
'role': newConnCollectionModel['role'],
'password': response.password,
'server_name': response.server_name,
'database_name': selected_database_name,
'server_name': _.escape(response.server_name),
'database_name': _.escape(selected_database_name),
};
handler.gridView.on_change_connection(connection_details, self);
}

View File

@ -32,7 +32,7 @@ export function getPanelTitle(pgBrowser, selected_item=null) {
const db_label = getDatabaseLabel(parentData);
return `${db_label}/${parentData.server.user.name}@${parentData.server.label}`;
return `${db_label}/${_.escape(parentData.server.user.name)}@${parentData.server.label}`;
}
export function setQueryToolDockerTitle(panel, is_query_tool, panel_title, is_file) {

View File

@ -246,7 +246,7 @@ define('tools.querytool', [
},
set_editor_title: function(title) {
this.$el.find('.editor-title').text(title);
this.$el.find('.editor-title').text(_.unescape(title));
this.render_connection(this.connection_list);
},
@ -2158,9 +2158,9 @@ define('tools.querytool', [
'sid': connection_details['server'],
'title': connection_details['title'],
};
self.set_editor_title(self.handler.url_params.title);
self.handler.setTitle(self.handler.url_params.title);
let success_msg = connection_details['server_name'] + '/' + connection_details['database_name']+ '- Database connected';
self.set_editor_title(_.unescape(self.handler.url_params.title));
self.handler.setTitle(_.unescape(self.handler.url_params.title));
let success_msg = connection_details['server_name'] + '/' + connection_details['database_name'] + '- Database connected';
alertify.success(success_msg);
if(ref){
let connection_data = {
@ -2527,8 +2527,8 @@ define('tools.querytool', [
'role': null,
'title': _.unescape(url_params.title),
'is_allow_new_connection': false,
'database_name': url_params.title.split('/')[0],
'server_name': url_params.title.split('@')[1],
'database_name': _.unescape(url_params.title.split('/')[0]),
'server_name': _.unescape(url_params.title.split('@')[1]),
};
self.gridView.connection_list.unshift(connection_data);
self.gridView.render_connection(self.gridView.connection_list);