diff --git a/web/pgadmin/tools/sqleditor/__init__.py b/web/pgadmin/tools/sqleditor/__init__.py index c713fb5..92e4b17 100644 --- a/web/pgadmin/tools/sqleditor/__init__.py +++ b/web/pgadmin/tools/sqleditor/__init__.py @@ -1121,16 +1121,13 @@ def load_file(): if request.data: file_data = json.loads(request.data.decode()) + file_path = unquote(file_data['file_name']) # retrieve storage directory path storage_manager_path = get_storage_directory() - if storage_manager_path is None: - storage_manager_path = "" + if storage_manager_path: + # generate full path of file + file_path = os.path.join(storage_manager_path, file_path.lstrip('/')) - # generate full path of file - file_path = os.path.join( - storage_manager_path, - unquote(file_data['file_name'].lstrip('/')) - ) file_data = None # check if file type is text or binary