mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Use POST instead of GET for Query Tool downloads to avoid errors with long queries. Fixes #4013
This commit is contained in:
@@ -1389,7 +1389,7 @@ def save_file():
|
|||||||
|
|
||||||
@blueprint.route(
|
@blueprint.route(
|
||||||
'/query_tool/download/<int:trans_id>',
|
'/query_tool/download/<int:trans_id>',
|
||||||
methods=["GET"],
|
methods=["POST"],
|
||||||
endpoint='query_tool_download'
|
endpoint='query_tool_download'
|
||||||
)
|
)
|
||||||
@login_required
|
@login_required
|
||||||
@@ -1401,7 +1401,7 @@ def start_query_download_tool(trans_id):
|
|||||||
if status and sync_conn is not None and \
|
if status and sync_conn is not None and \
|
||||||
trans_obj is not None and session_obj is not None:
|
trans_obj is not None and session_obj is not None:
|
||||||
|
|
||||||
data = request.args if request.args else None
|
data = request.values if request.values else None
|
||||||
try:
|
try:
|
||||||
if data and 'query' in data:
|
if data and 'query' in data:
|
||||||
sql = data['query']
|
sql = data['query']
|
||||||
|
|||||||
@@ -3564,17 +3564,14 @@ define('tools.querytool', [
|
|||||||
var self = this,
|
var self = this,
|
||||||
url = url_for('sqleditor.query_tool_download', {
|
url = url_for('sqleditor.query_tool_download', {
|
||||||
'trans_id': self.transId,
|
'trans_id': self.transId,
|
||||||
});
|
}),
|
||||||
|
data = { query: query, filename: filename };
|
||||||
url += '?' + $.param({
|
|
||||||
query: query,
|
|
||||||
filename: filename,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Get the CSV file
|
// Get the CSV file
|
||||||
self.download_csv_obj = $.ajax({
|
self.download_csv_obj = $.ajax({
|
||||||
type: 'GET',
|
type: 'POST',
|
||||||
url: url,
|
url: url,
|
||||||
|
data: data,
|
||||||
cache: false,
|
cache: false,
|
||||||
async: true,
|
async: true,
|
||||||
xhrFields: {
|
xhrFields: {
|
||||||
|
|||||||
Reference in New Issue
Block a user