Ensure that pgAdmin routes should have the SCRIPT_NAME prefix. #5344

pull/5461/head
Aditya Toshniwal 2022-10-20 16:24:11 +05:30 committed by GitHub
parent 80f897a513
commit cc6ee1ddd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 10 deletions

View File

@ -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