Fix an issue where setting STORAGE_DIR to empty should show all the volumes on Windows in server mode. Fixes #5025.

This commit is contained in:
Simon Wimmesberger 2020-01-13 13:20:37 +05:30 committed by Akshay Joshi
parent 45f2e35a99
commit 9dccd20bb3
3 changed files with 12 additions and 12 deletions

View File

@ -22,4 +22,5 @@ Bug fixes
| `Issue #3812 <https://redmine.postgresql.org/issues/3812>`_ - Ensure that path file name should not disappear when changing ext from the dropdown in file explorer dialog.
| `Issue #4827 <https://redmine.postgresql.org/issues/4827>`_ - Fix column resizable issue in the file explorer dialog.
| `Issue #5025 <https://redmine.postgresql.org/issues/5025>`_ - Fix an issue where setting STORAGE_DIR to empty should show all the volumes on Windows in server mode.
| `Issue #5074 <https://redmine.postgresql.org/issues/5074>`_ - Fix an issue where select, insert and update scripts on tables throwing an error.

View File

@ -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(

View File

@ -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)