From 8be3517c6dfed8a748fea83888b871430fd70bdd Mon Sep 17 00:00:00 2001 From: Nikhil Mohite Date: Thu, 4 Mar 2021 12:48:56 +0530 Subject: [PATCH] =?UTF-8?q?Fixed=20an=20issue=20where=C2=A0hanging=20symli?= =?UTF-8?q?nks=20in=20a=20directory=20cause=20select=20file=20dialog=20to?= =?UTF-8?q?=20break.=20Fixes=20#5119?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/en_US/release_notes_5_1.rst | 1 + web/pgadmin/misc/file_manager/__init__.py | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/en_US/release_notes_5_1.rst b/docs/en_US/release_notes_5_1.rst index caa85c1f9..ea5a384c5 100644 --- a/docs/en_US/release_notes_5_1.rst +++ b/docs/en_US/release_notes_5_1.rst @@ -20,6 +20,7 @@ Bug fixes | `Issue #4959 `_ - Fixed an issue where the properties tab for collection nodes is unresponsive after switching the tabs. | `Issue #5073 `_ - Fixed an issue where the Save button is enabled for functions/procedures by default when open the properties dialog. +| `Issue #5119 `_ - Fixed an issue where hanging symlinks in a directory cause select file dialog to break. | `Issue #5467 `_ - Allow underscores in the Windows installation path. | `Issue #5628 `_ - Remove the "launch now" option in the Windows installer, as UAC could cause it to run as an elevated user. | `Issue #6018 `_ - Fixed encoding issue when database encoding set to SQL_ASCII and name of the column is in ASCII character. diff --git a/web/pgadmin/misc/file_manager/__init__.py b/web/pgadmin/misc/file_manager/__init__.py index 9801b7c38..6a98d4bce 100644 --- a/web/pgadmin/misc/file_manager/__init__.py +++ b/web/pgadmin/misc/file_manager/__init__.py @@ -603,11 +603,13 @@ class Filemanager(object): # continue if file/folder is hidden (based on user preference) if not show_hidden_files and is_folder_hidden(system_path): continue - - user_path = os.path.join(os.path.join(user_dir, f)) - created = time.ctime(os.path.getctime(system_path)) - modified = time.ctime(os.path.getmtime(system_path)) - file_extension = str(splitext(system_path)) + try: + user_path = os.path.join(os.path.join(user_dir, f)) + created = time.ctime(os.path.getctime(system_path)) + modified = time.ctime(os.path.getmtime(system_path)) + file_extension = str(splitext(system_path)) + except Exception as e: + continue # set protected to 1 if no write or read permission protected = 0