mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Custom-encode forward slashes in URL parameters as Apache HTTPD doesn't allow them in some cases. Fixes #3998
This commit is contained in:
committed by
Dave Page
parent
ecbba79c2a
commit
36ffdb93e8
@@ -230,6 +230,16 @@ def panel(trans_id, is_query_tool, editor_title):
|
||||
else:
|
||||
server_type = None
|
||||
|
||||
# If title has slash(es) in it then replace it
|
||||
if request.args and request.args['fslashes'] != '':
|
||||
try:
|
||||
fslashesList = request.args['fslashes'].split(',')
|
||||
for idx in fslashesList:
|
||||
idx = int(idx)
|
||||
editor_title = editor_title[:idx] + '/' + editor_title[idx:]
|
||||
except IndexError as e:
|
||||
app.logger.exception(e)
|
||||
|
||||
# We need client OS information to render correct Keyboard shortcuts
|
||||
user_agent = UserAgent(request.headers.get('User-Agent'))
|
||||
|
||||
|
||||
@@ -234,17 +234,7 @@ define('pgadmin.datagrid', [
|
||||
return;
|
||||
}
|
||||
|
||||
var nsp_name = '';
|
||||
|
||||
if (parentData.schema != undefined) {
|
||||
nsp_name = parentData.schema.label;
|
||||
}
|
||||
else if (parentData.view != undefined) {
|
||||
nsp_name = parentData.view.label;
|
||||
}
|
||||
else if (parentData.catalog != undefined) {
|
||||
nsp_name = parentData.catalog.label;
|
||||
}
|
||||
let nsp_name = showData.retrieveNameSpaceName(parentData);
|
||||
|
||||
var url_params = {
|
||||
'cmd_type': data.mnuid,
|
||||
@@ -263,8 +253,8 @@ define('pgadmin.datagrid', [
|
||||
'did': url_params['did'],
|
||||
'obj_id': url_params['obj_id'],
|
||||
});
|
||||
var grid_title = parentData.server.label + '-' + parentData.database.label + '-'
|
||||
+ nsp_name + '.' + d.label;
|
||||
|
||||
let grid_title = showData.generateDatagridTitle(parentData, nsp_name, d);
|
||||
|
||||
// Create filter dialog using alertify
|
||||
if (!alertify.filterDialog) {
|
||||
@@ -481,13 +471,16 @@ define('pgadmin.datagrid', [
|
||||
}
|
||||
|
||||
// Open the panel if frame is initialized
|
||||
let titileForURLObj = sqlEditorUtils.removeSlashInTheString(grid_title);
|
||||
var url_params = {
|
||||
'trans_id': trans_obj.gridTransId,
|
||||
'is_query_tool': trans_obj.is_query_tool,
|
||||
'editor_title': encodeURIComponent(grid_title),
|
||||
'editor_title': titileForURLObj.title,
|
||||
},
|
||||
baseUrl = url_for('datagrid.panel', url_params) +
|
||||
'?' + 'query_url=' + encodeURI(trans_obj.sURL) + '&server_type=' + encodeURIComponent(trans_obj.server_type);
|
||||
'?' + 'query_url=' + encodeURI(trans_obj.sURL) +
|
||||
'&server_type=' + encodeURIComponent(trans_obj.server_type) +
|
||||
'&fslashes=' + titileForURLObj.slashLocations;
|
||||
|
||||
if (self.preferences.new_browser_tab) {
|
||||
var newWin = window.open(baseUrl, '_blank');
|
||||
|
||||
@@ -52,7 +52,7 @@ export function showDataGrid(
|
||||
}
|
||||
|
||||
|
||||
function retrieveNameSpaceName(parentData) {
|
||||
export function retrieveNameSpaceName(parentData) {
|
||||
if (parentData.schema !== undefined) {
|
||||
return parentData.schema.label;
|
||||
}
|
||||
@@ -87,6 +87,6 @@ function hasSchemaOrCatalogOrViewInformation(parentData) {
|
||||
parentData.catalog !== undefined;
|
||||
}
|
||||
|
||||
function generateDatagridTitle(parentData, namespaceName, nodeData) {
|
||||
export function generateDatagridTitle(parentData, namespaceName, nodeData) {
|
||||
return `${namespaceName}.${nodeData.label}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user