diff --git a/web/pgadmin/utils/__init__.py b/web/pgadmin/utils/__init__.py index 45fbb6ae9..31d9ee2bc 100644 --- a/web/pgadmin/utils/__init__.py +++ b/web/pgadmin/utils/__init__.py @@ -272,8 +272,12 @@ def filename_with_file_manager_path(_file, create_file=False, Filename to use for backup with full path taken from preference """ # retrieve storage directory path - last_storage = Preferences.module('file_manager').preference( - 'last_storage').get() + try: + last_storage = Preferences.module('file_manager').preference( + 'last_storage').get() + except Exception as e: + last_storage = MY_STORAGE + if last_storage != MY_STORAGE: selDirList = [sdir for sdir in current_app.config['SHARED_STORAGE'] if sdir['name'] == last_storage] diff --git a/web/regression/javascript/file_manager/FileManager.spec.js b/web/regression/javascript/file_manager/FileManager.spec.js index 63b60076d..73dc3f9fb 100644 --- a/web/regression/javascript/file_manager/FileManager.spec.js +++ b/web/regression/javascript/file_manager/FileManager.spec.js @@ -158,6 +158,7 @@ describe('FileManger', ()=>{ it('Change Shared Storage', (done)=>{ networkMock.onPost('/file_manager/init').reply(200, {'data': configData}); + networkMock.onPost(`/file_manager/save_last_dir/${transId}`).reply(200, {'success':1,'errormsg':'','info':'','result':null,'data':null}); let ctrl = ctrlMount({}); setTimeout(()=>{ ctrl.update(); @@ -171,6 +172,7 @@ describe('FileManger', ()=>{ it('Change Storage to My Storage', (done)=>{ networkMock.onPost('/file_manager/init').reply(200, {'data': configData}); + networkMock.onPost(`/file_manager/save_last_dir/${transId}`).reply(200, {'success':1,'errormsg':'','info':'','result':null,'data':null}); let ctrl = ctrlMount({}); setTimeout(()=>{ ctrl.update();