From cc6ee1ddd266af0b7a3bb97c756ea85c9b33529e Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Thu, 20 Oct 2022 16:24:11 +0530 Subject: [PATCH] Ensure that pgAdmin routes should have the SCRIPT_NAME prefix. #5344 --- web/pgadmin/__init__.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py index a7924354a..5bbb76284 100644 --- a/web/pgadmin/__init__.py +++ b/web/pgadmin/__init__.py @@ -123,21 +123,13 @@ class PgAdmin(Flask): # like 'localhost/pgadmin4' then we have to append '/pgadmin4' # into endpoints ############################################################# - import config - is_wsgi_root_present = False - if config.SERVER_MODE: - pgadmin_root_path = url_for('browser.index') - if pgadmin_root_path != '/browser/': - is_wsgi_root_present = True - wsgi_root_path = pgadmin_root_path.replace( - '/browser/', '' - ) + wsgi_root_path = current_app.config.get("APPLICATION_ROOT", "/") def get_full_url_path(url): """ Generate endpoint URL at per WSGI alias """ - if is_wsgi_root_present and url: + if wsgi_root_path != "/" and url: return wsgi_root_path + url else: return url