mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-08-07 11:45:07 -05:00
Fix the issue where Import/Export was failing in linux runtime. Fixes #2166
Issue: Changes done by Ashesh in pgAdmin4.py file for setting up PYTHONHOME variable to sys.prefix was applicable only for windows only. Additionally I have also added exception handling for file provided by user for Backup/Restore/Import/Export.
This commit is contained in:
committed by
Dave Page
parent
533833cb02
commit
bc63652811
@@ -226,7 +226,10 @@ def create_backup_job(sid):
|
||||
else:
|
||||
data = json.loads(request.data, encoding='utf-8')
|
||||
|
||||
backup_file = filename_with_file_manager_path(data['file'])
|
||||
try:
|
||||
backup_file = filename_with_file_manager_path(data['file'])
|
||||
except Exception as e:
|
||||
return bad_request(errormsg=str(e))
|
||||
|
||||
# Fetch the server details like hostname, port, roles etc
|
||||
server = Server.query.filter_by(
|
||||
@@ -324,7 +327,10 @@ def create_backup_objects_job(sid):
|
||||
else:
|
||||
data = json.loads(request.data, encoding='utf-8')
|
||||
|
||||
backup_file = filename_with_file_manager_path(data['file'])
|
||||
try:
|
||||
backup_file = filename_with_file_manager_path(data['file'])
|
||||
except Exception as e:
|
||||
return bad_request(errormsg=str(e))
|
||||
|
||||
# Fetch the server details like hostname, port, roles etc
|
||||
server = Server.query.filter_by(
|
||||
|
||||
@@ -223,7 +223,11 @@ def create_import_export_job(sid):
|
||||
storage_dir = get_storage_directory()
|
||||
|
||||
if 'filename' in data:
|
||||
_file = filename_with_file_manager_path(data['filename'], data['is_import'])
|
||||
try:
|
||||
_file = filename_with_file_manager_path(data['filename'], data['is_import'])
|
||||
except Exception as e:
|
||||
return bad_request(errormsg=str(e))
|
||||
|
||||
if not _file:
|
||||
return bad_request(errormsg=_('Please specify a valid file'))
|
||||
|
||||
|
||||
@@ -179,7 +179,10 @@ def create_restore_job(sid):
|
||||
else:
|
||||
data = json.loads(request.data, encoding='utf-8')
|
||||
|
||||
_file = filename_with_file_manager_path(data['file'])
|
||||
try:
|
||||
_file = filename_with_file_manager_path(data['file'])
|
||||
except Exception as e:
|
||||
return bad_request(errormsg=str(e))
|
||||
|
||||
if _file is None:
|
||||
return make_json_response(
|
||||
|
||||
Reference in New Issue
Block a user