diff --git a/docs/en_US/release_notes_4_18.rst b/docs/en_US/release_notes_4_18.rst index afd91a4d1..c1ed295f6 100644 --- a/docs/en_US/release_notes_4_18.rst +++ b/docs/en_US/release_notes_4_18.rst @@ -22,4 +22,5 @@ Bug fixes | `Issue #3812 `_ - Ensure that path file name should not disappear when changing ext from the dropdown in file explorer dialog. | `Issue #4827 `_ - Fix column resizable issue in the file explorer dialog. +| `Issue #5025 `_ - Fix an issue where settingĀ STORAGE_DIR to empty should show all the volumes on Windows in server mode. | `Issue #5074 `_ - Fix an issue where select, insert and update scripts on tables throwing an error. \ No newline at end of file diff --git a/web/pgadmin/misc/file_manager/__init__.py b/web/pgadmin/misc/file_manager/__init__.py index 19eecc1a6..c3bd72b4d 100644 --- a/web/pgadmin/misc/file_manager/__init__.py +++ b/web/pgadmin/misc/file_manager/__init__.py @@ -598,8 +598,6 @@ class Filemanager(object): Filemanager.resume_windows_warning() return files - if dir is None: - dir = "" orig_path = Filemanager.get_abs_path(dir, path) if not path_exists(orig_path): @@ -693,12 +691,13 @@ class Filemanager(object): # absolute path. orig_path = os.path.abspath(orig_path) - if _platform == 'win32': - if dir[-1] == '\\' or dir[-1] == '/': - dir = dir[:-1] - else: - if dir[-1] == '/': - dir = dir[:-1] + if dir: + if _platform == 'win32': + if dir[-1] == '\\' or dir[-1] == '/': + dir = dir[:-1] + else: + if dir[-1] == '/': + dir = dir[:-1] # Do not allow user to access outside his storage dir in server mode. if not orig_path.startswith(dir): @@ -710,7 +709,7 @@ class Filemanager(object): def get_abs_path(dir, path): if (path.startswith('\\\\') and _platform == 'win32')\ - or config.SERVER_MODE is False: + or config.SERVER_MODE is False or dir is None: return u"{}".format(path) if path == '/' or path == '\\': @@ -823,8 +822,8 @@ class Filemanager(object): trans_data = Filemanager.get_trasaction_selection(self.trans_id) dir = None if config.SERVER_MODE: - dir = self.dir if self.dir is not None else '' - if not dir.endswith('/'): + dir = self.dir + if dir is not None and not dir.endswith('/'): dir += u'/' filelist = self.list_filesystem( diff --git a/web/pgadmin/setup/data_directory.py b/web/pgadmin/setup/data_directory.py index 8433f994b..581643d1b 100644 --- a/web/pgadmin/setup/data_directory.py +++ b/web/pgadmin/setup/data_directory.py @@ -12,7 +12,7 @@ from flask import current_app def _create_directory_if_not_exists(_path): - if not os.path.exists(_path): + if _path and not os.path.exists(_path): os.mkdir(_path)