From d35433d0b87d47f4d590010ba498de567aaf8b04 Mon Sep 17 00:00:00 2001 From: Murtuza Zabuawala Date: Fri, 17 Apr 2020 12:40:09 +0530 Subject: [PATCH] =?UTF-8?q?Fixed=20an=20issue=20where=20the=20query=20tool?= =?UTF-8?q?=20unable=20to=20load=20the=20file=C2=A0which=20contains=20the?= =?UTF-8?q?=20BOM=20marker.=20Fixes=20#3495?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/en_US/release_notes_4_21.rst | 1 + web/pgadmin/misc/file_manager/__init__.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/en_US/release_notes_4_21.rst b/docs/en_US/release_notes_4_21.rst index ec2a2c82c..b8b49a643 100644 --- a/docs/en_US/release_notes_4_21.rst +++ b/docs/en_US/release_notes_4_21.rst @@ -26,6 +26,7 @@ Bug fixes ********* | `Issue #2813 `_ - Ensure that the password prompt should not be visible if the database server is in trust authentication mode. +| `Issue #3495 `_ - Fixed an issue where the query tool unable to load the file which contains the BOM marker. | `Issue #3523 `_ - Fixed an issue where right-clicking a browser object does not apply to the object on which right-click was fired. | `Issue #3645 `_ - Ensure that the start and end date should be deleted when clear the selection for pgAgent Job. | `Issue #3947 `_ - Fixed copy-paste row issues in View/Edit Data. diff --git a/web/pgadmin/misc/file_manager/__init__.py b/web/pgadmin/misc/file_manager/__init__.py index 5311034f4..39aa39315 100644 --- a/web/pgadmin/misc/file_manager/__init__.py +++ b/web/pgadmin/misc/file_manager/__init__.py @@ -1089,8 +1089,11 @@ class Filemanager(object): is_startswith_bom = True enc = encoding - # Check if string is binary - is_binary = is_binary_string(file_data) + # No need to check for binary file, a BOM marker already + # indicates that text stream afterwards + if not is_startswith_bom: + # Check if string is binary + is_binary = is_binary_string(file_data) except IOError as ex: status = False