Fix an issue where setting STORAGE_DIR to empty should show all the volumes on Windows in server mode. Fixes #5025.
parent
45f2e35a99
commit
9dccd20bb3
|
@ -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.
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue