Ensure that JSON files should be downloaded properly from the storage manager. Fixes #7118

This commit is contained in:
Rahul Shirsat 2022-01-25 20:17:50 +05:30 committed by Akshay Joshi
parent 04729f63b8
commit deab1bfaba
3 changed files with 8 additions and 12 deletions

View File

@ -23,6 +23,7 @@ Bug fixes
| `Issue #7035 <https://redmine.postgresql.org/issues/7035>`_ - Fixed an issue where connections keep open to (closed) connections on the initial connection to the database server.
| `Issue #7085 <https://redmine.postgresql.org/issues/7085>`_ - Ensure that Partitioned tables should be visible correctly when creating multiple partition levels.
| `Issue #7100 <https://redmine.postgresql.org/issues/7100>`_ - Fixed an issue where the Browser tree gets disappears when scrolling sequences.
| `Issue #7118 <https://redmine.postgresql.org/issues/7118>`_ - Ensure that JSON files should be downloaded properly from the storage manager.
| `Issue #7123 <https://redmine.postgresql.org/issues/7123>`_ - Fixed an issue where restore generates incorrect options for the schema.
| `Issue #7127 <https://redmine.postgresql.org/issues/7127>`_ - Added validation for Hostname in the server dialog.
| `Issue #7135 <https://redmine.postgresql.org/issues/7135>`_ - Enforce the minimum Windows version that the installer will run on.

View File

@ -1222,7 +1222,9 @@ class Filemanager(object):
else:
dir_path = os.path.dirname(path)
response = send_from_directory(dir_path, name, as_attachment=True)
response = send_from_directory(dir_path, name,
mimetype='application/octet-stream',
as_attachment=True)
response.headers["filename"] = name
return response

View File

@ -9,19 +9,12 @@
"""A blueprint module implementing the storage manager functionality"""
import simplejson as json
import os
from flask import url_for, Response, render_template, request, current_app
from flask import url_for, Response, render_template
from flask_babel import gettext as _
from flask_security import login_required, current_user
from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc
from pgadmin.utils import PgAdminModule, get_storage_directory, html, \
fs_short_path, document_dir, IS_WIN, does_utility_exist
from pgadmin.utils.ajax import make_json_response, bad_request
from flask_security import login_required
from config import PG_DEFAULT_DRIVER
from pgadmin.model import Server
from pgadmin.utils import PgAdminModule
from pgadmin.utils.ajax import bad_request
from pgadmin.utils.constants import MIMETYPE_APP_JS
MODULE_NAME = 'storage_manager'