From a2f4628590b58cca0f6841166e2dfb972783688e Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Mon, 23 Nov 2020 11:46:09 +0530 Subject: [PATCH] =?UTF-8?q?Explicitly=20set=20the=20mime-types=20so=20that?= =?UTF-8?q?=20a=20corrupted=20windows=20registry=20will=20not=20affect=20p?= =?UTF-8?q?gAdmin=204=20to=20be=20load=C2=A0properly.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/pgadmin/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py index bffdb4375..f5fd6ed7f 100644 --- a/web/pgadmin/__init__.py +++ b/web/pgadmin/__init__.py @@ -44,6 +44,13 @@ from pgadmin.utils.csrf import pgCSRFProtect from pgadmin import authenticate from pgadmin.utils.security_headers import SecurityHeaders +# Explicitly set the mime-types so that a corrupted windows registry will not +# affect pgAdmin 4 to be load properly. This will avoid the issues that may +# occur due to security fix of X_CONTENT_TYPE_OPTIONS = "nosniff". +import mimetypes +mimetypes.add_type('text/javascript', '.js') +mimetypes.add_type('text/css', '.css') + winreg = None if os.name == 'nt': import winreg